"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseCard from "@/components/sections/footer/FooterBaseCard";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from "@/components/navbar/NavbarStyleCentered/NavbarStyleCentered";
import { useBlogPosts } from "@/hooks/useBlogPosts";

export default function BlogPage() {
    const { posts, isLoading } = useBlogPosts();

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="largeSmall"
            background="none"
            cardStyle="solid"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="The Edge"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Services", id: "services" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Pricing", id: "pricing" }
                        ]}
                        button={{ text: "Book Now", href: "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">
                        <BlogCardOne
                            blogs={posts}
                            title="The Edge Blog"
                            description="Professional grooming tips, style guides, and barbershop insights from our expert team"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="The Edge"
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Haircuts", href: "#services" },
                                    { label: "Beard Grooming", href: "#services" },
                                    { label: "Hot Towel Shave", href: "#services" },
                                    { label: "Kids Cuts", href: "#services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Pricing", href: "#pricing" },
                                    { label: "Reviews", href: "#testimonials" },
                                    { label: "FAQ", href: "#faq" }
                                ]
                            },
                            {
                                title: "Visit Us",                                items: [
                                    { label: "123 Wynwood Ave, Miami, FL 33127", href: "https://maps.google.com" },
                                    { label: "(305) 555-EDGE", href: "tel:+13055553433" },
                                    { label: "Mon-Sat: 9AM - 7PM", href: "#" },
                                    { label: "Sun: 10AM - 5PM", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 The Edge Barber Shop. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}