"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterBaseReveal from '@/components/sections/footer/FooterBaseReveal';
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarLayoutFloatingInline from '@/components/navbar/NavbarLayoutFloatingInline';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="directional-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumSmall"
            sizing="mediumSizeLargeTitles"
            background="aurora"
            cardStyle="subtle-shadow"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="layered"
            headingFontWeight="bold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarLayoutFloatingInline
                        brandName="Apple iPhone"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{ text: "Shop Now", href: "#products" }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="Latest iPhone News & Updates"
                            description="Stay informed with the latest iPhone features, updates, and technology insights from Apple"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Apple Blog"
                        />
                    )}

                    <FooterBaseReveal
                        columns={[
                            {
                                title: "Products",                                items: [
                                    { label: "iPhone Pro Max", href: "#products" },
                                    { label: "iPhone Pro", href: "#products" },
                                    { label: "iPhone 15", href: "#products" },
                                    { label: "iPhone SE", href: "#products" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Features", href: "#features" },
                                    { label: "Pricing", href: "#pricing" },
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Contact Us", href: "#contact" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Blog", href: "#blog" },
                                    { label: "Careers", href: "#careers" },
                                    { label: "Privacy Policy", href: "#privacy" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 Apple iPhone Store. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}