"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="background-highlight"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="largeSmallSizeLargeTitles"
            background="aurora"
            cardStyle="outline"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <NavbarStyleApple
                    brandName="Bella Italia"
                    navItems={[
                        { name: "Home", id: "/" },
                        { name: "Menu", id: "/menu" },
                        { name: "About", id: "/about" },
                        { name: "Reservations", id: "/reservations" },
                        { name: "Contact", id: "/contact" },
                    ]}
                />

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <BlogCardTwo
                        blogs={posts}
                        title="Latest Articles"
                        description="Insights and updates from our team"
                        animationType="slide-up"
                        textboxLayout="default"
                        useInvertedBackground={false}
                        tag="Blog"
                        carouselMode="buttons"
                    />
                )}

                <FooterLogoEmphasis
                    logoText="Bella Italia"
                    columns={[
                        {
                            items: [
                                { label: "Home", href: "/" },
                                { label: "Menu", href: "/menu" },
                                { label: "Specials", href: "/menu#specials" },
                            ],
                        },
                        {
                            items: [
                                { label: "About Us", href: "/about" },
                                { label: "Our Team", href: "/about#team" },
                                { label: "Testimonials", href: "/#testimonials" },
                            ],
                        },
                        {
                            items: [
                                { label: "Reservations", href: "/reservations" },
                                { label: "Contact", href: "/contact" },
                                { label: "Location", href: "/contact#map" },
                            ],
                        },
                    ]}
                />
            </ReactLenis>
        </ThemeProvider>
    );
}
