"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
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="slide-background"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="small"
            sizing="largeSizeMediumTitles"
            background="circleGradient"
            cardStyle="layered-gradient"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Savour"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reservations", id: "reservation" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Fine Dining Experience"
                        bottomRightText="hello@savourrestaurant.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 Chronicles"
                            description="Discover the stories behind our exceptional dishes and dining experiences"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Savour"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "hero" },
                                    { label: "Menu", href: "menu" },
                                    { label: "Gallery", href: "gallery" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Reservations", href: "reservation" },
                                    { label: "Contact", href: "contact" },
                                    { label: "About", href: "about" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Reviews", href: "https://google.com/maps" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}