"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
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="hover-bubble"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="largeSmall"
            background="aurora"
            cardStyle="subtle-shadow"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Adopt", id: "/adopt" },
                            { name: "About", id: "/about" },
                            { name: "Contact", id: "/contact" },
                            { name: "Donate", id: "/donate" },
                            { name: "Shop", id: "/shop" },
                            { name: "Blog", id: "/blog" }
                        ]}
                        button={{ text: "Donate", href: "/donate" }}
                        brandName="Hope Haven"
                        className="py-4"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts} // Preserving existing posts logic
                            title="Our Latest Adventures" // Generated from BlogSection schema
                            description="Discover heartwarming stories and helpful tips for your furry friends." // Generated
                            tag="Blog" // Generated
                            animationType="slide-up" // Generated
                            textboxLayout="default" // Generated
                            useInvertedBackground={false} // Generated
                            carouselMode="buttons" // Generated (default, but explicitly set for clarity)
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        columns={[
                            {
                                title: "About Us",                                items: [
                                    { label: "Our Mission", href: "/about" },
                                    { label: "Meet the Team", href: "/about#team" },
                                    { label: "Impact Report", href: "/about#impact" }
                                ]
                            },
                            {
                                title: "Get Involved",                                items: [
                                    { label: "Adopt a Pet", href: "/adopt" },
                                    { label: "Volunteer", href: "/contact" },
                                    { label: "Foster a Pet", href: "/contact" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "FAQs", href: "/faq" },
                                    { label: "Pet Care Tips", href: "/blog" },
                                    { label: "Contact Us", href: "/contact" }
                                ]
                            }
                        ]}
                        logoText="Hope Haven"
                        copyrightText="© 2024 Hope Haven Animal Shelter. All rights reserved."
                        useInvertedBackground={false}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}