"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="directional-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="small"
            sizing="largeSmall"
            background="circleGradient"
            cardStyle="soft-shadow"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        brandName="Luxe Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Rooms", id: "rooms" },
                            { name: "Amenities", id: "amenities" },
                            { name: "About", id: "about" },
                            { 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 Hotel News & Insights"
                            description="Stay updated with our latest hospitality insights, travel tips, and exclusive offers from Luxe Haven Hotel"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Hotel Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Luxe Haven"
                        copyrightText="© 2025 Luxe Haven Hotel. All rights reserved."
                        columns={[
                            {
                                title: "Accommodations",                                items: [
                                    { label: "Deluxe Rooms", href: "rooms" },
                                    { label: "Suites", href: "rooms" },
                                    { label: "Family Rooms", href: "rooms" },
                                    { label: "Special Offers", href: "pricing" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Amenities", href: "amenities" },
                                    { label: "Dining", href: "amenities" },
                                    { label: "Spa & Wellness", href: "amenities" },
                                    { label: "Event Hosting", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Contact", href: "contact" },
                                    { label: "Careers", href: "#" },
                                    { label: "Blog", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}