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

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

    return (
        <ThemeProvider
            defaultButtonVariant="directional-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="medium"
            background="circleGradient"
            cardStyle="inset"
            primaryButtonStyle="radial-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="iPhone"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Reviews", id: "testimonials" },
                            { 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"
                            description="Stay updated with the latest iPhone features, tips, and industry insights"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    )}

                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/two-friends-taking-selfie-smartphone_23-2147828216.jpg"
                        imageAlt="Technology Background"
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "iPhone 15 Pro", href: "products" },
                                    { label: "iPhone 15", href: "products" },
                                    { label: "iPhone SE", href: "products" },
                                    { label: "Compare Models", href: "products" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Technical Support", href: "contact" },
                                    { label: "Warranty Info", href: "contact" },
                                    { label: "Returns & Exchanges", href: "contact" },
                                    { label: "Contact Us", href: "contact" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About iPhone", href: "about" },
                                    { label: "Innovation", href: "about" },
                                    { label: "Privacy Policy", href: "privacy" },
                                    { label: "Terms of Service", href: "terms" }
                                ]
                            }
                        ]}
                        logoText="iPhone"
                        copyrightText="© 2025 Apple iPhone Retail. All rights reserved."
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}