"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterMedia from '@/components/sections/footer/FooterMedia';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="mediumLarge"
            sizing="large"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Ollupa"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Featured", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" },
                            { name: "Shop", id: "https://shop.ollupa.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">
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest Flower Care Tips & News"
                            description="Discover expert insights on flower care, seasonal arrangements, and the latest trends in floral design"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/summer-vegetation_23-2147685410.jpg"
                        imageAlt="Beautiful flowers background"
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "Bouquets", href: "#products" },
                                    { label: "Seasonal", href: "#" },
                                    { label: "Custom Orders", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Our Story", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact", href: "mailto:hello@ollupa.com" },
                                    { label: "FAQ", href: "#" },
                                    { label: "Delivery Info", href: "#" }
                                ]
                            }
                        ]}
                        logoText="Ollupa"
                        copyrightText="© 2025 Ollupa Flowers. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}