"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterMedia from "@/components/sections/footer/FooterMedia";
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="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="sharp"
            contentWidth="smallMedium"
            sizing="largeSmallSizeMediumTitles"
            background="circleGradient"
            cardStyle="subtle-shadow"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Lika-Comfort"
                        bottomLeftText="Kyiv, Ukraine"
                        bottomRightText="info@lika-comfort.ua"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Latest HVAC Insights"
                            description="Expert tips, industry news, and technical guides for premium air conditioning solutions"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-vector/abstract-halftone-dots-background_1048-8194.jpg"
                        imageAlt="Lika-Comfort footer background"
                        columns={[
                            {
                                title: "Products",                                items: [
                                    { label: "Residential Units", href: "#products" },
                                    { label: "Commercial Systems", href: "#products" },
                                    { label: "Replacement Parts", href: "#products" },
                                    { label: "Accessories", href: "#products" }
                                ]
                            },
                            {
                                title: "Services",                                items: [
                                    { label: "Installation", href: "#features" },
                                    { label: "Maintenance", href: "#features" },
                                    { label: "Repairs", href: "#features" },
                                    { label: "Consultation", href: "#contact" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Contact", href: "#contact" },
                                    { label: "Careers", href: "#" },
                                    { label: "Support", href: "#contact" }
                                ]
                            }
                        ]}
                        logoText="LIKA-COMFORT"
                        copyrightText="© 2025 Lika-Comfort | Premium Air Conditioning Solutions | Kyiv, Ukraine"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}