"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterMedia from '@/components/sections/footer/FooterMedia';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="compact"
            sizing="mediumLargeSizeLargeTitles"
            background="floatingGradient"
            cardStyle="subtle-shadow"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="Sweet Haven Bakery"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Products", id: "products" },
                            { name: "Why Us", id: "why-us" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Order Online", href: "#contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Bakery Blog"
                            description="Discover the art of baking with tips, recipes, and stories from our kitchen"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    )}

                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/fresh-bread-wooden-spoon-old-wooden-background_169016-3149.jpg"
                        imageAlt="Artisan bakery with fresh bread and pastries"
                        logoText="Sweet Haven Bakery"
                        copyrightText="© 2025 Sweet Haven Bakery. All rights reserved."
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "Breads", href: "#products" },
                                    { label: "Pastries", href: "#products" },
                                    { label: "Custom Cakes", href: "#contact" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Why Choose Us", href: "#features" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Phone: (555) 123-4567", href: "tel:5551234567" },
                                    { label: "123 Main Street, Your City", href: "#" },
                                    { label: "Mon-Sat: 6AM - 7PM", href: "#" }
                                ]
                            }
                        ]}
                        ariaLabel="Site footer"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}