"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="medium"
            sizing="mediumLarge"
            background="noiseDiagonalGradient"
            cardStyle="layered-gradient"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="RBM's Attic Solutions"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "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="Expert Insights"
                            description="Discover valuable tips and insights for maintaining your home's attic, insulation, and roofing systems from our experienced professionals."
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Attic Cleaning", href: "#services" },
                                    { label: "Attic Repair", href: "#services" },
                                    { label: "Insulation", href: "#services" },
                                    { label: "Roofing", href: "#services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#trust-section" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Reviews", href: "#testimonials" },
                                    { label: "FAQ", href: "#faq" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Contact Us", href: "#contact" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 RBM's Attic Solutions, Insulation & Roofing. All rights reserved. Essex Junction, VT"
                        bottomRightText="Built for healthier, more comfortable homes."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}