"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import { useBlogPosts } from "@/hooks/useBlogPosts";

// Navbar import from NAVBAR_INFO
import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';

// BlogSection import from BLOG_SECTION_REGISTRY
import BlogCardOne from '@/components/sections/blog/BlogCardOne';

// Footer import from FOOTER_INFO
import FooterMedia from '@/components/sections/footer/FooterMedia';

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="largeSmallSizeMediumTitles"
            background="aurora"
            cardStyle="inset"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Menu", id: "menu" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" },
                        ]}
                        brandName="Смачно Bakery"
                        button={{ text: "Order Now", href: "contact" }}
                        buttonClassName="min-w-[120px] justify-center"
                        buttonTextClassName="text-center"
                        className="z-50"
                    />
                </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="Our Bakery's Blog"
                            description="Fresh stories, recipes, and news from Смачно Bakery."
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        columns={[
                            {
                                title: "Bakery",                                items: [
                                    { label: "Our Story", href: "about" },
                                    { label: "Menu", href: "menu" },
                                    { label: "Contact Us", href: "contact" },
                                ],
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "FAQ", href: "faq" },
                                    { label: "Shipping", href: "#" },
                                ],
                            },
                        ]}
                        logoText="Смачно Bakery"
                        copyrightText="© 2024 Смачно Bakery. All rights reserved."
                        imageSrc="https://img.b2bpic.net/free-photo/white-cheese-bread-with-eggs_140725-3991.jpg?_wi=3"
                        imageAlt="Warm and inviting interior of a traditional Ukrainian bakery"
                        useInvertedBackground={false}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
