"use client";

import ReactLenis from "lenis/react";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import { useBlogPosts } from "@/hooks/useBlogPosts";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import FooterLogoEmphasis from '@/components/sections/footer/FooterLogoEmphasis';
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import { Lightbulb } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="medium"
            sizing="largeSizeMediumTitles"
            background="circleGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "/#services" },
                            { name: "Why Us", id: "/#why-us" },
                            { name: "Contact", id: "/#contact" },
                        ]}
                        brandName="Johns Plumbing"
                    />
                </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">
                        <BlogCardTwo
                            blogs={posts}
                            title="From Our Blog"
                            description="Insights, tips, and news from the Johns Plumbing team."
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            tag="Plumbing Tips"
                            tagIcon={Lightbulb}
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        logoText="Johns Plumbing"
                        columns={[
                            { items: [{ label: "Services", href: "/#services" }, { label: "Why Johns", href: "/#why-us" }, { label: "Our Promise", href: "/#promise" }] },
                            { items: [{ label: "FAQ", href: "/#faq" }, { label: "Book Service", href: "/#contact" }, { label: "Call Now", href: "tel:(Your Phone Number)" }] },
                            { items: [{ label: "Email Us", href: "mailto:(Your Email)" }, { label: "Licensed & Insured", href: "#" }] },
                        ]}
                        ariaLabel="Site Footer - Johns Plumbing"
                        className="mt-auto"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}
