"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
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="bounce-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="mediumLargeSizeLargeTitles"
            background="circleGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="flat"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Carioca Constru & Co"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Services", id: "features" },
                            { name: "Blog", id: "blog" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Get in Touch", 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="Construction Insights & Updates"
                            description="Discover the latest trends, tips, and innovations in construction and sustainable building practices from our expert team."
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="Carioca Constru & Co"
                        columns={[
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Our Services", href: "#features" },
                                    { label: "Projects", href: "#features" },
                                    { label: "Blog", href: "#blog" }
                                ]
                            },
                            {
                                title: "Resources",                                items: [
                                    { label: "Construction Guide", href: "#blog" },
                                    { label: "Sustainability", href: "#features" },
                                    { label: "FAQs", href: "#blog" },
                                    { label: "News", href: "#blog" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Email: info@cariocaconstru.com", href: "mailto:info@cariocaconstru.com" },
                                    { label: "Phone: +55 21 3000-0000", href: "tel:+552130000000" },
                                    { label: "Rio de Janeiro, Brazil", href: "#" },
                                    { label: "Schedule Consultation", href: "#contact" }
                                ]
                            },
                            {
                                title: "Follow Us",                                items: [
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "LinkedIn", href: "https://linkedin.com" },
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Twitter", href: "https://twitter.com" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Carioca Constru & Co. All rights reserved. Building the future of Rio de Janeiro."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}