"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBase from "@/components/sections/footer/FooterBase";
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="reveal-blur"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="mediumLargeSizeMediumTitles"
            background="aurora"
            cardStyle="layered-gradient"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Sharp Cuts Barber"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Barbers", id: "barbers" },
                            { name: "Reviews", id: "testimonials" }
                        ]}
                        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="Sharp Cuts Blog"
                            description="Professional tips and insights from our expert barbers"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Sharp Cuts Barber"
                        copyrightText="© 2025 Sharp Cuts Barber. All rights reserved."
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Haircuts", href: "services" },
                                    { label: "Beard Trimming", href: "services" },
                                    { label: "Hot Shaves", href: "services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Barbers", href: "barbers" },
                                    { label: "Reviews", href: "testimonials" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Book Appointment", href: "contact" },
                                    { label: "Phone: (555) 123-4567", href: "tel:5551234567" },
                                    { label: "Hours: Tue-Sat 10am-7pm", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}