"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="text-stagger"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="largeSmall"
            background="aurora"
            cardStyle="inset"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Savoria"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Menu", id: "menu" },
                            { name: "Gallery", id: "gallery" },
                            { name: "About", id: "about" },
                            { name: "Reserve", id: "contact" }
                        ]}
                        button={{ text: "Book a Table", 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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Culinary Stories"
                            description="Discover the artistry behind our dishes and the passion that drives our kitchen"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Savoria"
                        columns={[
                            {
                                items: [
                                    { label: "Hours", href: "#" },
                                    { label: "Tue-Thu: 5PM-11PM", href: "#" },
                                    { label: "Fri-Sat: 5PM-12AM", href: "#" },
                                    { label: "Sunday: 5PM-10PM", href: "#" },
                                    { label: "Closed Mondays", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact", href: "#" },
                                    { label: "+1 (555) 123-4567", href: "tel:+15551234567" },
                                    { label: "hello@savoria.com", href: "mailto:hello@savoria.com" },
                                    { label: "123 Park Avenue", href: "#" },
                                    { label: "New York, NY 10017", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Menu", href: "menu" },
                                    { label: "Private Events", href: "#" },
                                    { label: "Wine List", href: "#" },
                                    { label: "Careers", href: "#" },
                                    { label: "Contact Us", href: "contact" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Follow Us", href: "#" },
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "LinkedIn", href: "https://linkedin.com" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}