"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import { useBlogPosts } from "@/hooks/useBlogPosts";

// New imports based on requirements
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="large"
            background="aurora"
            cardStyle="inset"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Hookah Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "/#products" },
                            { name: "About", id: "/#about" },
                            { name: "Features", id: "/#features" },
                            { name: "Testimonials", id: "/#testimonials" },
                            { name: "FAQ", id: "/#faq" },
                            { name: "Contact", id: "/#contact" },
                        ]}
                    />
                </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 Articles"
                                description="Insights and updates from our team"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                animationType="slide-up"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBaseCard
                            logoText="Hookah Haven"
                            columns={[
                                {
                                    title: "Shop",                                    items: [
                                        { label: "Hookahs", href: "/#products" },
                                        { label: "Tobacco", href: "/#products" },
                                        { label: "Charcoal", href: "/#products" },
                                        { label: "Accessories", href: "/#products" },
                                    ],
                                },
                                {
                                    title: "Company",                                    items: [
                                        { label: "About Us", href: "/#about" },
                                        { label: "FAQ", href: "/#faq" },
                                        { label: "Contact", href: "/#contact" },
                                    ],
                                },
                            ]}
                            copyrightText="© 2024 Hookah Haven. All rights reserved."
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
