"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBaseCard from '@/components/sections/footer/FooterBaseCard';
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="background-highlight"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="grid"
            cardStyle="layered-gradient"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="Superior Roofing & Exteriors"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "testimonials" },
                            { 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="Roofing & Exteriors Insights"
                            description="Expert advice and insights from Superior Roofing & Exteriors professionals"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                            tagAnimation="slide-up"
                            buttonAnimation="slide-up"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBaseCard
                        logoText="Superior Roofing"
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Roof Replacement", href: "#services" },
                                    { label: "Gutter Services", href: "#services" },
                                    { label: "Siding Installation", href: "#services" },
                                    { label: "Roof Inspection", href: "#services" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Reviews", href: "#testimonials" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Service Area", href: "#" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Call: (630) 413-3999", href: "tel:(630)413-3999" },
                                    { label: "1620 Pebblewood Ln, Naperville, IL", href: "#" },
                                    { label: "Open 9 AM - 5 PM", href: "#" },
                                    { label: "Free Estimates", href: "#contact" }
                                ]
                            }
                        ]
                        copyrightText="© 2025 Superior Roofing & Exteriors. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}