"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="small"
            sizing="mediumLarge"
            background="none"
            cardStyle="outline"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingOverlay
                        brandName="TechAcademy"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Courses", id: "courses" },
                            { name: "About", id: "about" },
                            { name: "Instructors", id: "team" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{ text: "Enroll Now", href: "#contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and educational content from our expert instructors"
                            tag="Tech Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    )}

                    <FooterLogoEmphasis
                        logoText="TechAcademy"
                        columns={[
                            {
                                items: [
                                    { label: "Courses", href: "#courses" },
                                    { label: "Instructors", href: "#team" },
                                    { label: "About", href: "#about" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Testimonials", href: "#testimonials" },
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Blog", href: "#" },
                                    { label: "Community", href: "#" },
                                    { label: "Support", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}