"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";

const footerColumns: FooterColumn[] = [
    {
        title: "Product",        items: [
            { label: "Serums", href: "#products" },
            { label: "Ingredients", href: "#features" },
            { label: "How to Use", href: "#faq" },
        ],
    },
    {
        title: "Company",        items: [
            { label: "About Us", href: "#about" },
            { label: "Our Story", href: "#about" },
            { label: "Sustainability", href: "#" },
        ],
    },
    {
        title: "Support",        items: [
            { label: "Contact", href: "#contact" },
            { label: "FAQ", href: "#faq" },
            { label: "Shipping Info", href: "#" },
        ],
    },
];

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

    return (
        <ThemeProvider
            defaultButtonVariant="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="medium"
            sizing="mediumLargeSizeLargeTitles"
            background="noise"
            cardStyle="gradient-radial"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Products", id: "products" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Contact", id: "contact" },
                        ]}
                        brandName="Luminous"
                        bottomLeftText="Skincare for Women"
                        bottomRightText="hello@luminous.com"
                    />
                </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="Beauty Insights"
                            description="Discover the latest trends and tips for radiant, healthy skin from our skincare experts"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterBase
                        logoText="Luminous"
                        copyrightText="© 2025 Luminous Skincare. All rights reserved."
                        columns={footerColumns}
                        onPrivacyClick={null}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}