"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterLogoEmphasis from "@/components/sections/footer/FooterLogoEmphasis";
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="shift-hover"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="largeSmall"
            background="noiseDiagonalGradient"
            cardStyle="inset"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="semibold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Storm Damage", id: "storm" },
                            { name: "Gallery", id: "projects" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Viking Construction"
                        bottomLeftText="Licensed & Insured"
                        bottomRightText="Fast Response • Insurance Support"
                    />
                </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="Construction Insights & Updates"
                            description="Expert tips, project showcases, and industry news from Viking Construction"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                            ariaLabel="Viking Construction blog section"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterLogoEmphasis
                        columns={[
                            {
                                items: [
                                    { label: "Home", href: "/" },
                                    { label: "Services", href: "/services" },
                                    { label: "Storm Damage", href: "/storm-damage" },
                                    { label: "Projects", href: "/projects" }
                                ]
                            },
                            {
                                items: [
                                    { label: "About Us", href: "#" },
                                    { label: "Inspections", href: "#" },
                                    { label: "Starlink Mounting", href: "#" },
                                    { label: "Contact", href: "/contact" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Warranty Info", href: "#" },
                                    { label: "Insurance FAQ", href: "#" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Call Us", href: "tel:1-800-ROOFING" },
                                    { label: "Text Us", href: "#" },
                                    { label: "Email Support", href: "mailto:support@vikingconstruction.com" },
                                    { label: "24/7 Emergency", href: "tel:1-800-ROOFING" }
                                ]
                            }
                        ]}
                        logoText="Viking Construction"
                        ariaLabel="Site footer with navigation and contact links"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}