"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
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-bubble"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="medium"
            sizing="mediumLarge"
            background="noise"
            cardStyle="subtle-shadow"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" },
                            { name: "Gallery", id: "gallery" }
                        ]}
                        brandName="Northstar Roofing"
                        bottomLeftText="North Dakota Roofing"
                        bottomRightText="(701) 555-0100"
                    />
                </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="Roofing Insights & Tips"
                            description="Expert advice and industry updates from North Dakota's premier roofing specialists"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Roof Replacement", href: "/residential" },
                                    { label: "Roof Repair", href: "/residential" },
                                    { label: "Storm Damage", href: "/storm-damage" },
                                    { label: "Commercial", href: "/commercial" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "/about" },
                                    { label: "Gallery", href: "/gallery" },
                                    { label: "Reviews", href: "/reviews" },
                                    { label: "Contact", href: "/contact" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Phone: (701) 555-0100", href: "tel:+17015550100" },
                                    { label: "Emergency: 24/7 Available", href: "tel:+17015550100" },
                                    { label: "Licensed & Insured", href: "#" },
                                    { label: "BBB Accredited", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Northstar Roofing LLC. North Dakota Roofing Specialists. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}