"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="small"
            sizing="mediumLarge"
            background="none"
            cardStyle="glass-elevated"
            primaryButtonStyle="flat"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reservations", id: "reservations" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Culinary Haven"
                        bottomLeftText="Open Daily 5PM - 11PM"
                        bottomRightText="reservations@culinaryhaven.com"
                    />
                </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="Culinary Stories"
                            description="Discover the artistry and passion behind our culinary creations"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoReveal
                        logoText="Culinary Haven"
                        leftLink={{ text: "Privacy Policy", href: "/privacy" }}
                        rightLink={{ text: "Terms of Service", href: "/terms" }}
                        ariaLabel="Site footer"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}