"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="medium"
            sizing="largeSmallSizeLargeTitles"
            background="circleGradient"
            cardStyle="glass-depth"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Futurama"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Characters", id: "characters" },
                            { name: "Episodes", id: "episodes" },
                            { 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">
                        <BlogCardThree
                            blogs={posts}
                            title="Planet Express Chronicles"
                            description="Journey through the universe with the crew's latest adventures and discoveries from the 31st century"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Adventures"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Watch",                                items: [
                                    { label: "Hulu", href: "https://www.hulu.com" },
                                    { label: "Disney+", href: "https://www.disneyplus.com" },
                                    { label: "Netflix", href: "https://www.netflix.com" },
                                    { label: "Amazon Prime", href: "https://www.primevideo.com" }
                                ]
                            },
                            {
                                title: "Community",                                items: [
                                    { label: "Fan Forum", href: "https://www.reddit.com/r/futurama" },
                                    { label: "Social Media", href: "https://www.twitter.com" },
                                    { label: "News", href: "#" },
                                    { label: "Events", href: "#" }
                                ]
                            },
                            {
                                title: "About",                                items: [
                                    { label: "The Show", href: "about" },
                                    { label: "Merchandise", href: "#" },
                                    { label: "Credits", href: "#" },
                                    { label: "Contact", href: "contact" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Futurama. All rights reserved. A creation of Matt Groening."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}