"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 NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="mediumLarge"
            background="floatingGradient"
            cardStyle="glass-depth"
            primaryButtonStyle="flat"
            secondaryButtonStyle="layered"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Sharp Cuts Barbershop"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Services", id: "services" },
                            { name: "Team", id: "team" },
                            { name: "Contact", id: "contact" }
                        ]}
                        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">
                        <BlogCardThree
                            blogs={posts}
                            title="Sharp Cuts Journal"
                            description="Discover the latest trends, tips, and stories from our expert barbers"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Sharp Cuts"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "home" },
                                    { label: "Services", href: "services" },
                                    { label: "About", href: "about" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Team", href: "team" },
                                    { label: "Pricing", href: "pricing" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Book Online", href: "contact" },
                                    { label: "Gift Cards", href: "contact" },
                                    { label: "Call Us", href: "tel:+1-555-0123" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}