"use client";

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

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

    return (
        <ThemeProvider
            defaultButtonVariant="hover-bubble"
            defaultTextAnimation="background-highlight"
            borderRadius="soft"
            contentWidth="compact"
            sizing="largeSizeMediumTitles"
            background="circleGradient"
            cardStyle="outline"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleApple
                        brandName="iPhone"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Models", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Specs", id: "metrics" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Support", id: "faq" }
                        ]}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardTwo
                            blogs={posts}
                            title="iPhone Insights"
                            description="Discover the latest features, reviews, and insights about iPhone technology and innovation"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Tech Blog"
                        />
                    )}

                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/mockup-mobile-phone-screen_53876-63379.jpg"
                        imageAlt="iPhone product lineup"
                        logoText="iPhone"
                        copyrightText="© 2025 Apple Inc. All rights reserved."
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "iPhone Models", href: "#products" },
                                    { label: "Compare", href: "#features" },
                                    { label: "Specs", href: "#metrics" },
                                    { label: "Trade In", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Help & Support", href: "#faq" },
                                    { label: "AppleCare+", href: "#" },
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "Service Status", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#" },
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}