"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="shift-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="medium"
            sizing="largeSmall"
            background="aurora"
            cardStyle="elevated"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Team", id: "team" },
                            { name: "Achievements", id: "achievements" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Goleodor"
                        bottomLeftText="Soccer Excellence Since 2018"
                        bottomRightText="join@goleodor.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 News & Updates"
                            description="Stay informed with the latest news, match updates, and insights from Goleodor FC"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Navigate",                                items: [
                                    { label: "Home", href: "#home" },
                                    { label: "About", href: "#about" },
                                    { label: "Team", href: "#team" }
                                ]
                            },
                            {
                                title: "Programs",                                items: [
                                    { label: "Youth Academy", href: "#" },
                                    { label: "Competitive Teams", href: "#" },
                                    { label: "Training", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact", href: "#contact" },
                                    { label: "Email", href: "mailto:join@goleodor.com" },
                                    { label: "Follow Us", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Goleodor FC. All rights reserved."
                        bottomRightText="Developing Champions Since 2018"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}