"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 NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";
import { BookOpen } from 'lucide-react';

const footerColumns: FooterColumn[] = [
    {
        title: "Product",        items: [
            { label: "Features", href: "features" },
            { label: "Solutions", href: "#features" },
            { label: "Pricing", href: "#features" },
        ],
    },
    {
        title: "Company",        items: [
            { label: "About", href: "about" },
            { label: "Blog", href: "#features" },
            { label: "Careers", href: "#contact" },
        ],
    },
    {
        title: "Connect",        items: [
            { label: "Contact", href: "contact" },
            { label: "Twitter", href: "https://twitter.com" },
            { label: "LinkedIn", href: "https://linkedin.com" },
        ],
    },
];

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

    return (
        <ThemeProvider
            defaultButtonVariant="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="largeSmallSizeMediumTitles"
            background="floatingGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="solid"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleFullscreen
                        brandName="Peak Creations"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Features", id: "features" },
                            { name: "About", id: "about" },
                            { name: "Metrics", id: "metrics" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="AI Innovation"
                        bottomRightText="hello@peakcreations.ai"
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Discover insights and innovations from the Peak Creations team"
                            tag="Blog"
                            tagIcon={BookOpen}
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterBase
                        logoText="Peak Creations"
                        copyrightText="© 2025 Peak Creations. All rights reserved."
                        columns={footerColumns}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}