"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="large"
            background="fluid"
            cardStyle="inset"
            primaryButtonStyle="flat"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="Luxe Haven"
                        navItems={[
                            {"name":"Home","id":"/"},
                            {"name":"About","id":"about"},
                            {"name":"Rooms","id":"rooms"},
                            {"name":"Amenities","id":"amenities"},
                            {"name":"Pricing","id":"pricing"},
                            {"name":"Reviews","id":"testimonials"}
                        ]}
                        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">
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Discover luxury hospitality insights and travel inspiration"
                            tag="Hotel Blog"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/traveller-calling-hotel-concierge_482257-79728.jpg"
                        imageAlt="Luxe Haven Hotel Exterior"
                        logoText="Luxe Haven"
                        copyrightText="© 2025 Luxe Haven Hotels. All rights reserved."
                        columns={[
                            {
                                "title":"Rooms",                                "items":[
                                    {"label":"Deluxe Rooms","href":"#rooms"},
                                    {"label":"Premium Suites","href":"#rooms"},
                                    {"label":"Presidential Suite","href":"#rooms"},
                                    {"label":"Special Offers","href":"#pricing"}
                                ]
                            },
                            {
                                "title":"Services",                                "items":[
                                    {"label":"Spa & Wellness","href":"#amenities"},
                                    {"label":"Fine Dining","href":"#amenities"},
                                    {"label":"Concierge","href":"#contact"},
                                    {"label":"Events & Meetings","href":"#contact"}
                                ]
                            },
                            {
                                "title":"Company",                                "items":[
                                    {"label":"About Us","href":"#about"},
                                    {"label":"Contact","href":"#contact"},
                                    {"label":"Careers","href":"#"},
                                    {"label":"Loyalty Program","href":"#"}
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
