"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="mediumSizeLargeTitles"
            background="aurora"
            cardStyle="solid"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Lorenzo Noya"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Achievements", id: "achievements" },
                            { name: "Skills", id: "skills" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Based in Italy"
                        bottomRightText="lorenzo@example.com"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Articles & Insights"
                            description="Explore my thoughts on water polo, training techniques, and competitive strategies"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/male-athlete-playing-water-polo-indoor-pool_23-2150579126.jpg"
                        imageAlt="Water polo training"
                        logoText="Lorenzo Noya"
                        copyrightText="© 2025 Lorenzo Noya. All rights reserved."
                        columns={[
                            {
                                title: "Navigation",                                items: [
                                    { label: "About", href: "about" },
                                    { label: "Achievements", href: "achievements" },
                                    { label: "Skills", href: "skills" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Social",                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "GitHub", href: "https://github.com" },
                                    { label: "Instagram", href: "https://instagram.com" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Email", href: "mailto:lorenzo@example.com" },
                                    { label: "Phone", href: "tel:+39123456789" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}