"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="small"
            sizing="mediumSizeLargeTitles"
            background="aurora"
            cardStyle="subtle-shadow"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="The Grand Hotel"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Rooms", id: "rooms" },
                            { name: "Amenities", id: "amenities" },
                            { name: "Gallery", id: "gallery" },
                            { name: "Contact", id: "contact" },
                        ]}
                        button={{ text: "Book Now", href: "#contact" }}
                        className="py-4 px-6 md:px-12"
                        buttonClassName="px-5 py-2"
                        buttonTextClassName="font-semibold"
                    />
                </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="From Our Blog"
                                description="Explore the latest stories, tips, and insights from our team of experts."
                                animationType="slide-up"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                carouselMode="buttons"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterMedia
                            imageSrc="https://img.b2bpic.net/free-photo/wooden-sauna-with-mountain-view-panoramic-calm_169016-70823.jpg?_wi=3"
                            imageAlt="Luxurious hotel lobby with elegant decor"
                            columns={[
                                { title: "Hotel", items: [{ label: "About Us", href: "#about" }, { label: "Our Rooms", href: "#rooms" }, { label: "Amenities", href: "#amenities" }] },
                                { title: "Guest Services", items: [{ label: "Concierge", href: "#" }, { label: "Dining", href: "#" }, { label: "Spa", href: "#" }] },
                                { title: "Legal", items: [{ label: "Privacy Policy", href: "/privacy" }, { label: "Terms of Service", href: "/terms" }] },
                            ]}
                            logoText="The Grand Hotel"
                            copyrightText="© 2024 The Grand Hotel. All rights reserved."
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
