"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
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="bounce-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="soft"
            contentWidth="mediumLarge"
            sizing="largeSizeMediumTitles"
            background="circleGradient"
            cardStyle="solid"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "About", id: "about" },
                            { name: "Reviews", id: "reviews" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Trucking & Construction"
                        bottomLeftText="Family Owned | Texas Based"
                        bottomRightText="Ready to Move Texas Forward"
                    />
                </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="Latest Trucking & Construction News"
                            description="Stay updated with industry insights, project highlights, and company updates from across Texas"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/blue-truck-rural-highway-with-green-line-logistics-motion_169016-69998.jpg"
                        imageAlt="Trucking and construction services across Texas"
                        logoText="Trucking & Construction Company of Texas"
                        columns={[
                            {
                                title: "Services",                                items: [
                                    { label: "Heavy Hauling", href: "/services#heavy-hauling" },
                                    { label: "Freight Transport", href: "/services#freight" },
                                    { label: "Equipment Transport", href: "/services#equipment" },
                                    { label: "Construction Services", href: "/services#construction" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "/about" },
                                    { label: "Our Team", href: "/about#team" },
                                    { label: "Reviews", href: "/reviews" },
                                    { label: "Contact", href: "/contact" }
                                ]
                            },
                            {
                                title: "Contact",                                items: [
                                    { label: "Call: (512) 555-0000", href: "tel:+1-512-555-0000" },
                                    { label: "Email: info@truckingco.tx", href: "mailto:info@truckingco.tx" },
                                    { label: "Service Area: All of Texas", href: "#" },
                                    { label: "24/7 Dispatch", href: "#" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Trucking & Construction Company of Texas. All rights reserved. Family Owned & Operated."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}