"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="medium"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="flat"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <CustomNavbar
                        logo="BvB Young"
                        links={[
                            {"label":"Home","href":"/"},
                            {"label":"About","href":"/about"},
                            {"label":"Players","href":"/players"},
                            {"label":"News","href":"/news"},
                            {"label":"Contact","href":"/contact"}
                        ]}
                        navItems={[
                            {"name":"Home","id":"/"}
                        ]}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Latest News & Updates"
                            description="Stay updated with the latest news from BvB Young academy"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="News"
                        />
                    )}

                    <FooterSection
                        companyName="BvB Young"
                        description="Developing the next generation of football champions"
                        sections={[
                            {
                                "title":"Quick Links",                                "links":[
                                    {"label":"Home","href":"/"},
                                    {"label":"About","href":"/about"},
                                    {"label":"Players","href":"/players"},
                                    {"label":"News","href":"/news"}
                                ]
                            },
                            {
                                "title":"Contact",                                "links":[
                                    {"label":"Email: info@bvbyoung.com","href":"mailto:info@bvbyoung.com"},
                                    {"label":"Phone: +49 231 1234567","href":"tel:+4923112345567"}
                                ]
                            }
                        ]}
                        socialLinks={[
                            {"platform":"facebook","url":"https://facebook.com/bvbyoung"},
                            {"platform":"instagram","url":"https://instagram.com/bvbyoung"},
                            {"platform":"twitter","url":"https://twitter.com/bvbyoung"}
                        ]}
                        copyright="© 2024 BvB Young. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}