"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 { Twitter, Linkedin, Github } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="mediumSizeLargeTitles"
            background="floatingGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "/about" },
                            { name: "Pricing", id: "/pricing" },
                            { name: "Contact", id: "/contact" }
                        ]}
                        brandName="AIFlow"
                        bottomLeftText="Enterprise AI Solutions"
                        bottomRightText="hello@aiflow.io"
                    />
                </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="Featured Articles"
                            description="Discover insights from AI leaders and explore the future of enterprise automation"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="opacity"
                            buttonAnimation="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="AIFlow"
                        copyrightText="© 2025 AIFlow. All rights reserved."
                        socialLinks={[
                            {
                                icon: Twitter,
                                href: "https://twitter.com/aiflow",                                ariaLabel: "Twitter"
                            },
                            {
                                icon: Linkedin,
                                href: "https://linkedin.com/company/aiflow",                                ariaLabel: "LinkedIn"
                            },
                            {
                                icon: Github,
                                href: "https://github.com/aiflow",                                ariaLabel: "GitHub"
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
