"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="elastic-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="mediumLarge"
            background="fluid"
            cardStyle="soft-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="MyCo"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "/#about" },
                            { name: "Features", id: "/#features" },
                            { name: "Products", id: "/#products" },
                            { name: "Testimonials", id: "/#testimonials" },
                            { name: "FAQ", id: "/#faq" },
                            { name: "Contact", id: "/#contact" },
                            { name: "Blog", id: "/blog" },
                            { name: "Shop", id: "/shop" }
                        ]}
                    />
                </div>

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading blog posts...</p>
                        </div>
                    ) : (
                        <div id="blog" data-section="blog">
                            <BlogCardTwo
                                blogs={posts}
                                title="Latest Insights & Updates"
                                description="Stay informed with our articles and news."
                                textboxLayout="default"
                                useInvertedBackground={false}
                                animationType="slide-up"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBaseCard
                            logoText="MyCo"
                            columns={[
                                {
                                    title: "Solutions",                                    items: [
                                        { label: "Products", href: "/#products" },
                                        { label: "Features", href: "/#features" }
                                    ]
                                },
                                {
                                    title: "Company",                                    items: [
                                        { label: "About Us", href: "/#about" },
                                        { label: "Blog", href: "/blog" },
                                        { label: "FAQ", href: "/#faq" },
                                        { label: "Contact", href: "/#contact" }
                                    ]
                                }
                            ]}
                            copyrightText="© 2024 MyCo. All rights reserved."
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
