"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBaseReveal from "@/components/sections/footer/FooterBaseReveal";
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="medium"
            background="none"
            cardStyle="solid"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Archviz"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Process", id: "process" },
                            { name: "Team", id: "team" },
                            { name: "Contact", id: "contact" },
                            { name: "Portfolio", id: "portfolio" }
                        ]}
                        button={{ text: "Start Project", 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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Insights"
                            description="Explore our architectural insights, design trends, and project stories from the world of visualization"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Studio",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Our Process", href: "process" },
                                    { label: "Team", href: "team" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Portfolio", href: "#portfolio" },
                                    { label: "Case Studies", href: "#" },
                                    { label: "Blog", href: "#" },
                                    { label: "Press", href: "#" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Email", href: "mailto:hello@archviz.com" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Archviz Design Studio. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}