"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="mediumLargeSizeMediumTitles"
            background="floatingGradient"
            cardStyle="solid"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Courses", id: "programs" },
                            { name: "Team", id: "team" },
                            { name: "Contact", id: "contact" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        brandName="IT Academy"
                        bottomLeftText="Building Tech Talent"
                        bottomRightText="hello@itacademy.com"
                    />

                    {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 knowledge from the IT Academy team"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    )}

                    <FooterCard
                        logoText="IT Academy"
                        copyrightText="© 2025 IT Academy. All rights reserved. | Building the next generation of tech talent."
                        socialLinks={[
                            {
                                icon: Linkedin,
                                href: "https://linkedin.com/company/it-academy",                                ariaLabel: "LinkedIn"
                            },
                            {
                                icon: Twitter,
                                href: "https://twitter.com/it_academy",                                ariaLabel: "Twitter"
                            },
                            {
                                icon: Facebook,
                                href: "https://facebook.com/itacademy",                                ariaLabel: "Facebook"
                            },
                            {
                                icon: Instagram,
                                href: "https://instagram.com/it_academy",                                ariaLabel: "Instagram"
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}