"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterCard from '@/components/sections/footer/FooterCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { Instagram, Facebook, Twitter, Youtube } from 'lucide-react';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="small"
            sizing="largeSmall"
            background="aurora"
            cardStyle="glass-depth"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="RaceDrive"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Experience", id: "experience" },
                            { name: "Vehicles", id: "vehicles" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Reviews", id: "reviews" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Book Now", href: "contact" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="Racing Insights"
                            description="Explore our latest articles on high-performance racing, driving techniques, and automotive excellence"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    )}

                    <FooterCard
                        logoText="RaceDrive"
                        copyrightText="© 2025 RaceDrive. All rights reserved. Pure performance, pure adrenaline."
                        socialLinks={[
                            { icon: Instagram, href: "https://instagram.com", ariaLabel: "Instagram" },
                            { icon: Facebook, href: "https://facebook.com", ariaLabel: "Facebook" },
                            { icon: Twitter, href: "https://twitter.com", ariaLabel: "Twitter" },
                            { icon: Youtube, href: "https://youtube.com", ariaLabel: "YouTube" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}