"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import { useBlogPosts } from "@/hooks/useBlogPosts";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import FooterSimple from '@/components/sections/footer/FooterSimple';
import BlogCardOne from '@/components/sections/blog/BlogCardOne';

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="mediumSmall"
            sizing="mediumLarge"
            background="noiseDiagonalGradient"
            cardStyle="outline"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                        ]}
                        brandName="The Grand Hotel"
                        bottomLeftText="Your Luxurious Escape"
                        bottomRightText="reservations@grandhotel.com"
                        topBarClassName="h-20"
                    />
                </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">
                        <BlogCardOne
                            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">
                    <FooterSimple
                        columns={[
                            {
                                title: "Explore",                                items: [
                                    { label: "Rooms & Suites", href: "/#rooms" },
                                    { label: "Amenities", href: "/#features" },
                                    { label: "Gallery", href: "/#hero" },
                                ],
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Dining", href: "/#hero" },
                                    { label: "Spa", href: "/#features" },
                                    { label: "Events" },
                                ],
                            },
                            {
                                title: "About",                                items: [
                                    { label: "Our Story", href: "/#about" },
                                    { label: "Careers" },
                                    { label: "Press" },
                                ],
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy" },
                                    { label: "Terms of Service" },
                                ],
                            },
                        ]}
                        bottomLeftText="© 2024 The Grand Hotel. All rights reserved."
                        bottomRightText="Crafted with Distinction"
                        ariaLabel="Site footer"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
