"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="compact"
            sizing="largeSmallSizeLargeTitles"
            background="floatingGradient"
            cardStyle="layered-gradient"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingInline
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Rooms", id: "/#products" },
                            { name: "Amenities", id: "/#features" },
                            { name: "Contact", id: "/#contact" },
                        ]}
                        brandName="Grand Stay"
                        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", href: "/#products" },
                                    { label: "Amenities", href: "/#features" },
                                ],
                            },
                            {
                                title: "Guest Services",                                items: [
                                    { label: "FAQ", href: "/#faq" },
                                    { label: "Contact Us", href: "/#contact" },
                                    { label: "Privacy Policy", href: "/privacy" },
                                ],
                            },
                            {
                                title: "Follow Us",                                items: [
                                    { label: "Facebook", href: "https://facebook.com/grandstay" },
                                    { label: "Instagram", href: "https://instagram.com/grandstay" },
                                    { label: "Twitter", href: "https://twitter.com/grandstay" },
                                ],
                            },
                        ]}
                        copyrightText="© 2024 Grand Stay. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
