"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 NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Instagram, Facebook, Twitter } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="medium"
            background="none"
            cardStyle="solid"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Angel Tours"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Tours", id: "tours" },
                            { name: "About", id: "about" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Reviews", id: "testimonials" }
                        ]}
                        button={{
                            text: "Book Now",                            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">
                        <BlogCardThree
                            blogs={posts}
                            title="Travel Stories & Insights"
                            description="Discover Madrid through our expert guides' eyes with insider tips, hidden gems, and unforgettable experiences from the heart of Spain's capital."
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Angel Tours"
                        copyrightText="© 2025 Angel Tours Madrid. All rights reserved. Crafted to celebrate the magic of Spain's capital."
                        socialLinks={[
                            {
                                icon: Instagram,
                                href: "https://instagram.com/angeltoursmadriad",                                ariaLabel: "Instagram"
                            },
                            {
                                icon: Facebook,
                                href: "https://facebook.com/angeltoursmadriad",                                ariaLabel: "Facebook"
                            },
                            {
                                icon: Twitter,
                                href: "https://twitter.com/angeltoursmadriad",                                ariaLabel: "Twitter"
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}