"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
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="elastic-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="small"
            sizing="largeSmallSizeLargeTitles"
            background="none"
            cardStyle="glass-depth"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="Sweet Haven Bakery"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" },
                            { name: "Menu", id: "features" }
                        ]}
                        button={{ text: "Order Now", href: "contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Sweet Haven Stories"
                            description="Discover the latest recipes, baking tips, and stories from our bakery"
                            tag="Our Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterBaseCard
                        logoText="Sweet Haven"
                        columns={[
                            {
                                title: "Hours",                                items: [
                                    { label: "Monday - Friday", href: "#" },
                                    { label: "6:00 AM - 7:00 PM", href: "#" },
                                    { label: "Saturday - Sunday", href: "#" },
                                    { label: "7:00 AM - 6:00 PM", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone: (555) 123-4567", href: "#" },
                                    { label: "Email: hello@sweethaven.com", href: "#" },
                                    { label: "123 Main Street", href: "#" },
                                    { label: "Your City, ST 12345", href: "#" }
                                ]
                            },
                            {
                                title: "Menu",                                items: [
                                    { label: "Pastries", href: "#products" },
                                    { label: "Breads", href: "#products" },
                                    { label: "Custom Cakes", href: "#contact" },
                                    { label: "Seasonal Items", href: "#products" }
                                ]
                            },
                            {
                                title: "Follow Us",                                items: [
                                    { label: "Facebook", href: "#" },
                                    { label: "Instagram", href: "#" },
                                    { label: "Twitter", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Sweet Haven Bakery. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}