"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterLogoEmphasis from "@/components/sections/footer/FooterLogoEmphasis";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from "@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen";
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="small"
            sizing="largeSmall"
            background="noiseDiagonalGradient"
            cardStyle="inset"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Pawsitive Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Adopt", id: "featured-pets" },
                            { name: "About Us", id: "about" },
                            { name: "Get Involved", id: "how-to-help" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Saving Lives, One Paw at a Time"
                        bottomRightText="info@pawsitivehaven.org"
                    />
                </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}
                            title="Latest Articles"
                            description="Stay updated with insights from our team about pet care, adoption stories, and animal welfare"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Pawsitive Haven"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "#home" },
                                    { label: "Featured Pets", href: "#featured-pets" },
                                    { label: "About Us", href: "#about" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Get Involved", href: "#how-to-help" },
                                    { label: "Donate", href: "https://example.com/donate" },
                                    { label: "Volunteer", href: "https://example.com/volunteer" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact", href: "mailto:info@pawsitivehaven.org" },
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}