"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="icon-arrow"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="medium"
            background="aurora"
            cardStyle="solid"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reservations", id: "reservations" }
                        ]}
                        brandName="Savour"
                        bottomLeftText="Fine Dining Experience"
                        bottomRightText="hello@savour.restaurant"
                    />
                </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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Culinary Stories"
                            description="Discover the passion, techniques, and stories behind our exceptional cuisine"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Dine",                                items: [
                                    { label: "Menu", href: "#menu" },
                                    { label: "Reservations", href: "#reservations" },
                                    { label: "Private Events", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "About", href: "#about" },
                                    { label: "Gallery", href: "#gallery" },
                                    { label: "Contact", href: "#reservations" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "hello@savour.restaurant", href: "mailto:hello@savour.restaurant" },
                                    { label: "(555) 123-4567", href: "tel:+15551234567" },
                                    { label: "123 Culinary Lane, Gastro City, GC 12345", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Savour Restaurant | Crafting Memories, One Dish at a Time"
                        className="w-full"
                        containerClassName="w-full"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}