"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 NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="medium"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="inset"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="layered"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background" id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Paws Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Adopt", id: "featured-pets" },
                            { name: "About Us", id: "about" },
                            { name: "How It Works", id: "adoption-process" },
                            { name: "Support", id: "support" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Start Adoption", href: "featured-pets" }}
                    />

                    {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">
                            <BlogCardOne
                                blogs={posts}
                                title="Paws & Tales"
                                description="Heartwarming stories and helpful tips from our animal shelter community"
                                tag="Pet Stories"
                                textboxLayout="default"
                                useInvertedBackground="noInvert"
                                carouselMode="buttons"
                                animationType="slide-up"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterMedia
                            imageSrc="https://img.b2bpic.net/free-photo/woman-pink-coat-walking-dogs_1157-45723.jpg"
                            imageAlt="Paws Haven shelter facility"
                            logoText="Paws Haven"
                            copyrightText="© 2025 Paws Haven Animal Shelter | All animals deserve loving homes"
                            columns={[
                                {
                                    title: "Adopt",                                    items: [
                                        { label: "Available Pets", href: "featured-pets" },
                                        { label: "Adoption Process", href: "adoption-process" },
                                        { label: "Success Stories", href: "testimonials" }
                                    ]
                                },
                                {
                                    title: "Support",                                    items: [
                                        { label: "Donate", href: "#" },
                                        { label: "Volunteer", href: "#" },
                                        { label: "Sponsor a Pet", href: "#" }
                                    ]
                                },
                                {
                                    title: "About",                                    items: [
                                        { label: "Our Story", href: "about" },
                                        { label: "Contact Us", href: "contact" },
                                        { label: "Careers", href: "#" }
                                    ]
                                }
                            ]}
                            onPrivacyClick={null}
                            ariaLabel="Paws Haven footer"
                        />
                    </div>
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}