"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 NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="medium"
            background="circleGradient"
            cardStyle="elevated"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Tallinn Old Town"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Attractions", id: "attractions" },
                            { name: "History", id: "history" },
                            { name: "Events", id: "events" },
                            { name: "Plan Your Visit", id: "faq" },
                            { name: "Products", id: "/products" }
                        ]}
                        button={{ text: "Get Started", href: "contact" }}
                    />
                </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="Discover Tallinn's Stories"
                            description="Explore the rich history, vibrant culture, and medieval charm of Tallinn's Old Town through our curated articles and insights"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tagAnimation="slide-up"
                            buttonAnimation="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/aerial-view-historical-center-lviv-ukraine_231208-68.jpg"
                        imageAlt="Tallinn Old Town sunset"
                        logoText="Tallinn Old Town"
                        copyrightText="© 2025 Tallinn Old Town | Preserving Medieval Heritage"
                        columns={[
                            {
                                title: "Explore",                                items: [
                                    { label: "Attractions", href: "attractions" },
                                    { label: "History", href: "history" },
                                    { label: "Events", href: "events" },
                                    { label: "Plan Visit", href: "faq" }
                                ]
                            },
                            {
                                title: "Information",                                items: [
                                    { label: "About", href: "about" },
                                    { label: "Cultural Guide", href: "events" },
                                    { label: "Travel Tips", href: "events" },
                                    { label: "Testimonials", href: "testimonials" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact Us", href: "contact" },
                                    { label: "Newsletter", href: "contact" },
                                    { label: "Visit Website", href: "https://www.visittallinn.ee" },
                                    { label: "Social Media", href: "https://www.instagram.com/visittallinn" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}