"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="small"
            sizing="largeSmall"
            background="grid"
            cardStyle="glass-elevated"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <NavbarStyleApple
                    brandName="Gladiatogo"
                    navItems={[
                        { name: "Home", id: "/" },
                        { name: "Fleet", id: "#fleet" },
                        { name: "About", id: "#about" },
                        { name: "Testimonials", id: "#testimonials" },
                        { name: "Contact", id: "#contact" },
                    ]}
                />

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <BlogCardOne
                        blogs={posts}
                        title="Latest Articles"
                        description="Insights and updates from our team"
                        animationType="slide-up"
                        textboxLayout="default"
                        useInvertedBackground={false}
                        carouselMode="buttons"
                    />
                )}

                <FooterMedia
                    imageSrc="https://img.b2bpic.net/free-photo/car-with-lights-driving-down-road_23-2151850179.jpg"
                    imageAlt="Road with cars at sunset"
                    logoText="Gladiatogo"
                    columns={[
                        {
                            title: "Company",                            items: [
                                { label: "About Us", href: "#about" },
                                { label: "Our Fleet", href: "#fleet" },
                                { label: "Careers", href: "#" },
                            ],
                        },
                        {
                            title: "Support",                            items: [
                                { label: "FAQs", href: "#faq" },
                                { label: "Contact", href: "#contact" },
                                { label: "Help Center", href: "#" },
                            ],
                        },
                        {
                            title: "Legal",                            items: [
                                { label: "Privacy Policy", href: "#" },
                                { label: "Terms of Service", href: "#" },
                            ],
                        },
                    ]}
                    copyrightText="© 2024 Gladiatogo. All rights reserved."
                />
            </ReactLenis>
        </ThemeProvider>
    );
}
