"use client";

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

const navItems = [
    { name: "Home", id: "/" },
    { name: "Blog", id: "/blog" },
    { name: "Shop", id: "/shop" },
    { name: "Contact", id: "/#contact-us" },
];

const footerColumns = [
    {
        title: "Adoption",        items: [
            { label: "Available Pets", href: "/#available-pets" },
            { label: "Adoption Process", href: "/#adoption-process" },
        ],
    },
    {
        title: "Get Involved",        items: [
            { label: "Volunteer", href: "/#contact-us" },
            { label: "Donate", href: "https://example.com/donate" },
        ],
    },
    {
        title: "About Us",        items: [
            { label: "Our Mission", href: "/#about-us" },
            { label: "Contact Us", href: "/#contact-us" },
        ],
    },
];

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="medium"
            background="circleGradient"
            cardStyle="gradient-mesh"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        navItems={navItems}
                        brandName="Pet Haven"
                    />
                </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">
                        <BlogCardThree
                            blogs={posts}
                            title="Our Latest Stories"
                            description="Discover heartwarming tales and helpful tips from the Pet Haven community."
                            tag="Updates"
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={footerColumns}
                        copyrightText="© 2024 | Pet Haven. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
