"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="expand-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="mediumLargeSizeMediumTitles"
            background="circleGradient"
            cardStyle="gradient-bordered"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <NavbarStyleFullscreen
                    navItems={[
                        { name: "Home", id: "/" },
                        { name: "About", id: "about" },
                        { name: "Services", id: "services" },
                        { name: "Work", id: "work" },
                        { name: "Testimonials", id: "testimonials" }
                    ]}
                    brandName="Custom European Landscaping"
                    bottomLeftText="Timeless Craftsmanship"
                    bottomRightText="(XXX) XXX-XXXX"
                />

                <main>
                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Latest Articles"
                            description="Insights and updates from our team"
                            animationType="slide-up"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                        />
                    )}
                </main>

                <FooterLogoEmphasis
                    columns={[
                        {
                            items: [
                                { label: "Home", href: "/" },
                                { label: "About Us", href: "#about" },
                                { label: "Our Services", href: "#services" },
                                { label: "View Our Work", href: "#work" }
                            ]
                        },
                        {
                            items: [
                                { label: "Client Reviews", href: "#testimonials" },
                                { label: "Our Process", href: "#process" },
                                { label: "Request Consultation", href: "#contact" },
                                { label: "(XXX) XXX-XXXX", href: "tel:XXX-XXX-XXXX" }
                            ]
                        }
                    ]}
                    logoText="Custom European Landscaping"
                    logoClassName="text-4xl font-serif text-foreground mb-4"
                    columnClassName="text-foreground/80"
                    itemClassName="text-foreground/70 hover:text-foreground transition-colors"
                    containerClassName="border-t-2 border-border pt-12 pb-8"
                    className="bg-card"
                />
            </ReactLenis>
        </ThemeProvider>
    );
}
