"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="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="largeSizeMediumTitles"
            background="floatingGradient"
            cardStyle="gradient-mesh"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Paradise Resort"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Rooms", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Contact", id: "contact" }
                        ]}
                        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">
                        <BlogCardOne
                            blogs={posts}
                            title="Resort News & Updates"
                            description="Discover the latest happenings, travel tips, and exclusive insights from Paradise Resort"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/umbrella-chair-around-swimming-pool-resort-hotel-leisure-travel-vacation_74190-8221.jpg"
                        imageAlt="Aerial view of Paradise Resort"
                        logoText="Paradise Resort"
                        copyrightText="© 2025 Paradise Resort. All rights reserved. Located in Puerto Rico."
                        columns={[
                            {
                                title: "Rooms & Suites",                                items: [
                                    { label: "Garden View Suite", href: "#pricing" },
                                    { label: "Beachfront Luxury", href: "#pricing" },
                                    { label: "Presidential Penthouse", href: "#pricing" }
                                ]
                            },
                            {
                                title: "Experiences",                                items: [
                                    { label: "Spa & Wellness", href: "#features" },
                                    { label: "Fine Dining", href: "#features" },
                                    { label: "Island Tours", href: "#" },
                                    { label: "Water Sports", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Reservations", href: "#contact" },
                                    { label: "Concierge", href: "#contact" },
                                    { label: "Press Inquiries", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}