"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="background-highlight"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="largeSmall"
            background="circleGradient"
            cardStyle="inset"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Luxe Haven"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Rooms", id: "rooms" },
                            { name: "Amenities", id: "amenities" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "reviews" },
                            { 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="Hotel Insights & News"
                            description="Discover the latest updates, travel tips, and exclusive offers from Luxe Haven Hotel"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/interior-design-bedroom-with-modern-decoration_181624-46706.jpg"
                        imageAlt="Luxe Haven hotel exterior at sunset"
                        logoText="Luxe Haven"
                        copyrightText="© 2025 Luxe Haven Hotel. All rights reserved."
                        columns={[
                            {
                                title: "Accommodations",                                items: [
                                    { label: "Deluxe Rooms", href: "rooms" },
                                    { label: "Executive Suites", href: "rooms" },
                                    { label: "Special Offers", href: "#" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Spa & Wellness", href: "amenities" },
                                    { label: "Dining", href: "amenities" },
                                    { label: "Concierge", href: "contact" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone: +1 (555) 123-4567", href: "#" },
                                    { label: "Email: hello@luxehaven.com", href: "#" },
                                    { label: "Address: 123 Coastal Drive", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}