"use client";

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

// Import the specified navbar component
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';

// Import the specified blog section component
import BlogCardOne from '@/components/sections/blog/BlogCardOne';

// Import the specified footer component
import FooterMedia from '@/components/sections/footer/FooterMedia';

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSmall"
            background="none"
            cardStyle="subtle-shadow"
            primaryButtonStyle="flat"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "/#about" },
                            { name: "Pricing", id: "/#pricing" },
                            { name: "Shop", id: "/shop" },
                            { name: "Team", id: "/#team" },
                            { name: "Testimonials", id: "/#testimonials" },
                            { name: "Contact", id: "/#contact" }
                        ]}
                        brandName="Angola"
                        bottomLeftText="Experience the Beauty"
                        bottomRightText="hello@angola.com"
                    />
                </div>

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

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="http://img.b2bpic.net/free-photo/beautiful-decoration-cute-little-dried-colorful-flowers-wallpaper_343596-3238.jpg?_wi=2"
                        imageAlt="Soft, blurred pastel flowers in a tranquil setting"
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "Bouquets", href: "/shop" },
                                    { label: "Arrangements", href: "/shop" },
                                    { label: "Custom Orders", href: "/#contact" },
                                ],
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "/#about" },
                                    { label: "Contact", href: "/#contact" },
                                ],
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Instagram", href: "https://instagram.com/angola_flowers" },
                                    { label: "Facebook", href: "https://facebook.com/angola_flowers" },
                                ],
                            },
                        ]}
                        logoText="Angola"
                        copyrightText="© 2024 Angola Flowers Studio. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
