"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
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="text-stagger"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="compact"
            sizing="largeSizeMediumTitles"
            background="aurora"
            cardStyle="inset"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleApple
                        brandName="iPhone Store"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardOne
                            blogs={posts}
                            title="Latest iPhone Insights"
                            description="Stay updated with our latest news, reviews, and tips for iPhone users"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-vector/abstract-technology-science-background-with-connecting-lines_1017-22915.jpg"
                        imageAlt="Technology innovation background"
                        logoText="iPhone Store"
                        copyrightText="© 2025 iPhone Store. All rights reserved."
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "iPhone 15 Pro", href: "products" },
                                    { label: "iPhone 15", href: "products" },
                                    { label: "Accessories", href: "products" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "about" },
                                    { label: "Contact", href: "contact" },
                                    { label: "Blog", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Warranty", href: "#" },
                                    { label: "Technical Support", href: "#" },
                                    { label: "Returns", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}