"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterCard from '@/components/sections/footer/FooterCard';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { Phone, Mail, MapPin } from 'lucide-react';

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="soft"
            contentWidth="medium"
            sizing="largeSizeMediumTitles"
            background="none"
            cardStyle="subtle-shadow"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="normal"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleCentered
                        brandName="Dallas Plumbing Pros"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "How It Works", id: "process" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Book Service", 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="Plumbing Insights"
                            description="Expert tips and insights for Dallas homeowners"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterCard
                        logoText="Dallas Plumbing Pros"
                        copyrightText="© 2025 Dallas Plumbing Pros. All rights reserved. Precision plumbing for Dallas homes."
                        socialLinks={[
                            { icon: Phone, href: "tel:+1-855-DAL-PROS", ariaLabel: "Call Dallas Plumbing Pros" },
                            { icon: Mail, href: "mailto:service@dallasplumbingpros.com", ariaLabel: "Email Dallas Plumbing Pros" },
                            { icon: MapPin, href: "https://maps.google.com/?q=Dallas+TX", ariaLabel: "Visit Dallas Plumbing Pros location" }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}