"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="slide-background"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="largeSizeMediumTitles"
            background="circleGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Collections", id: "collections" },
                            { name: "About", id: "about" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Ignat"
                        bottomLeftText="Premium Flowers"
                        bottomRightText="hello@ignatflowers.com"
                    />
                </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="Floral Inspiration"
                            description="Discover the beauty and artistry behind our premium flower arrangements"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Ignat"
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "home" },
                                    { label: "Collections", href: "collections" },
                                    { label: "About", href: "about" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Contact", href: "contact" },
                                    { label: "Delivery Info", href: "#" },
                                    { label: "Custom Orders", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "FAQ", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}