"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
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="text-stagger"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="mediumLargeSizeMediumTitles"
            background="grid"
            cardStyle="outline"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="glass"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Tony's Tire Shop"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Tires", id: "tires" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Call Now", href: "tel:+1-800-TIRES-01" }}
                    />
                </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="Tony's Tire Shop Blog"
                            description="Expert tire advice, maintenance tips, and automotive insights from our experienced team"
                            tag="Automotive"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Tony's Tire Shop"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "/" },
                                    { label: "Services", href: "#services" },
                                    { label: "Tires", href: "/tires" },
                                    { label: "About", href: "/about" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact", href: "/contact" },
                                    { label: "Book Service", href: "#booking" },
                                    { label: "Get a Quote", href: "#quote" },
                                    { label: "Call: (800) 123-4567", href: "tel:+1-800-123-4567" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Hours: Mon-Fri 7am-6pm", href: "#" },
                                    { label: "Hours: Sat 8am-4pm", href: "#" },
                                    { label: "Sunday: Closed", href: "#" },
                                    { label: "Get Directions", href: "#map" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Warranty Info", href: "#" },
                                    { label: "Financing", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}