"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
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="bounce-effect"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="floatingGradient"
            cardStyle="solid"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="OMAKASE NISEKO"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Experience", id: "experience" },
                            { name: "Menu", id: "menu" },
                            { name: "Ambiance", id: "ambiance" },
                            { name: "About", id: "about" }
                        ]}
                        button={{ text: "Reserve", 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="Featured Stories"
                            description="Discover the essence of authentic Japanese cuisine through our culinary journey"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="OMAKASE NISEKO"
                        copyrightText="© 2025 Omakase Niseko | All Rights Reserved"
                        columns={[
                            {
                                title: "Experience",                                items: [
                                    { label: "Our Omakase", href: "experience" },
                                    { label: "Menu", href: "menu" },
                                    { label: "Ambiance", href: "ambiance" }
                                ]
                            },
                            {
                                title: "Dining",                                items: [
                                    { label: "Reservations", href: "contact" },
                                    { label: "Group Bookings", href: "contact" },
                                    { label: "Private Events", href: "contact" }
                                ]
                            },
                            {
                                title: "Niseko",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Location", href: "about" },
                                    { label: "Contact", href: "contact" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}