"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-magnetic"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="medium"
            sizing="mediumSizeLargeTitles"
            background="aurora"
            cardStyle="glass-depth"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        brandName="Roof Repair LLC"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Areas We Serve", id: "areas" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Licensed & Insured"
                        bottomRightText="1-800-ROOF-FIX"
                    />
                </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="Roofing Insights & Tips"
                            description="Expert advice and updates from your trusted roofing professionals"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Expert Tips"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="http://img.b2bpic.net/free-photo/worker-with-level-building-roof-house_23-2148748855.jpg"
                        imageAlt="Professional roofing work"
                        logoText="Roof Repair LLC"
                        copyrightText="© 2025 Roof Repair LLC. Licensed & Insured. All rights reserved."
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Leak Repair", href: "#services" },
                                    { label: "Storm Damage", href: "#services" },
                                    { label: "Shingle Replacement", href: "#services" },
                                    { label: "Emergency Roofing", href: "#services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#why-choose-us" },
                                    { label: "Our Process", href: "#process" },
                                    { label: "Reviews", href: "#testimonials" },
                                    { label: "Contact", href: "#contact" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "1-800-ROOF-FIX", href: "tel:1-800-7663-3499" },
                                    { label: "Emergency: 24/7", href: "tel:1-800-7663-3499" },
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "License & Insurance", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}