"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBase from '@/components/sections/footer/FooterBase';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import type { FooterColumn } from "@/components/shared/FooterColumns";
import NavbarStyleApple from '@/components/navbar/NavbarStyleApple/NavbarStyleApple';
import { useBlogPosts } from "@/hooks/useBlogPosts";

const footerColumns: FooterColumn[] = [
    {
        title: "Services",        items: [
            { label: "Branding", href: "#services" },
            { label: "Social Media", href: "#services" },
            { label: "Paid Ads", href: "#services" },
            { label: "Web Design", href: "#services" },
        ],
    },
    {
        title: "Company",        items: [
            { label: "About", href: "#why-kg" },
            { label: "Process", href: "#process" },
            { label: "Contact", href: "#contact" },
            { label: "Privacy", href: "#" },
        ],
    },
    {
        title: "Connect",        items: [
            { label: "Instagram", href: "https://instagram.com" },
            { label: "LinkedIn", href: "https://linkedin.com" },
            { label: "Twitter", href: "https://twitter.com" },
            { label: "Email", href: "mailto:hello@kgdigital360.com" },
        ],
    },
];

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="mediumLarge"
            sizing="largeSmall"
            background="fluid"
            cardStyle="outline"
            primaryButtonStyle="inset-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleApple
                        brandName="K&G Digital 360"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Services", id: "services" },
                            { name: "Why K&G", id: "why-kg" },
                            { name: "Process", id: "process" },
                            { 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="Digital Insights"
                            description="Expert perspectives on branding, social media, and digital marketing strategies that drive results"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="K&G Digital 360"
                        copyrightText="© 2025 K&G Digital 360. All rights reserved."
                        columns={footerColumns}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}