"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterCard from '@/components/sections/footer/FooterCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Facebook, Instagram, Linkedin, Twitter } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="medium"
            sizing="mediumLargeSizeLargeTitles"
            background="none"
            cardStyle="gradient-bordered"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarLayoutFloatingOverlay
                        brandName="PropertyHub"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Browse", id: "listings" },
                            { name: "About", id: "about" },
                            { name: "Services", id: "services" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "List Property",                            href: "https://example.com/list"
                        }}
                    />
                </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="Explore our latest insights and updates from the PropertyHub team"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="PropertyHub"
                        copyrightText="© 2025 PropertyHub. All rights reserved."
                        socialLinks={[
                            {
                                icon: Facebook,
                                href: "https://facebook.com/propertyhub",                                ariaLabel: "Facebook"
                            },
                            {
                                icon: Instagram,
                                href: "https://instagram.com/propertyhub",                                ariaLabel: "Instagram"
                            },
                            {
                                icon: Linkedin,
                                href: "https://linkedin.com/company/propertyhub",                                ariaLabel: "LinkedIn"
                            },
                            {
                                icon: Twitter,
                                href: "https://twitter.com/propertyhub",                                ariaLabel: "Twitter"
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}