"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="slide-background"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="medium"
            background="fluid"
            cardStyle="glass-depth"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Elysian Hotel"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Rooms", id: "rooms" },
                            { name: "Amenities", id: "amenities" },
                            { name: "Gallery", id: "gallery" },
                            { 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">
                            <BlogCardTwo
                                blogs={posts}
                                title="Latest Articles"
                                description="Insights and updates from our team"
                                animationType="slide-up"
                                textboxLayout="default"
                                useInvertedBackground={false}
                                carouselMode="buttons"
                            />
                        </div>
                    )}

                    <div id="footer" data-section="footer">
                        <FooterBaseReveal
                            columns={[
                                {
                                    title: "Hotel",                                    items: [
                                        { label: "About Us", href: "#about" },
                                        { label: "Rooms & Suites", href: "#rooms" },
                                        { label: "Amenities", href: "#amenities" },
                                    ],
                                },
                                {
                                    title: "Guest Services",                                    items: [
                                        { label: "FAQs", href: "#faq" },
                                        { label: "Contact", href: "#contact" },
                                        { label: "Book Now", href: "#contact" },
                                    ],
                                },
                                {
                                    title: "Legal",                                    items: [
                                        { label: "Privacy Policy", href: "/privacy" },
                                        { label: "Terms of Service", href: "/terms" },
                                    ],
                                },
                            ]}
                            copyrightText="© 2024 The Elysian Hotel. All rights reserved."
                        />
                    </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
