"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBase from '@/components/sections/footer/FooterBase';
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="bounce-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="small"
            sizing="medium"
            background="aurora"
            cardStyle="glass-depth"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Paws Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Pets", id: "pets" },
                            { name: "Adopt", id: "adopt" },
                            { name: "Impact", id: "impact" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Adopt Today", href: "adopt" }}
                    />
                </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="Latest Pet Stories"
                            description="Discover heartwarming stories and helpful insights from our pet rescue community"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Paws Haven"
                        copyrightText="© 2025 Paws Haven Shelter. All rights reserved."
                        columns={[
                            {
                                title: "Adopt",                                items: [
                                    { label: "Available Pets", href: "pets" },
                                    { label: "Adoption Process", href: "adopt" },
                                    { label: "FAQ", href: "#" }
                                ]
                            },
                            {
                                title: "About",                                items: [
                                    { label: "Our Mission", href: "about" },
                                    { label: "Our Impact", href: "impact" },
                                    { label: "Testimonials", href: "testimonials" }
                                ]
                            },
                            {
                                title: "Get Involved",                                items: [
                                    { label: "Volunteer", href: "#" },
                                    { label: "Donate", href: "#" },
                                    { label: "Contact Us", href: "contact" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}