"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterBase from "@/components/sections/footer/FooterBase";
import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="elastic-effect"
            defaultTextAnimation="entrance-slide"
            borderRadius="rounded"
            contentWidth="mediumLarge"
            sizing="largeSizeMediumTitles"
            background="aurora"
            cardStyle="gradient-mesh"
            primaryButtonStyle="shadow"
            secondaryButtonStyle="radial-glow"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleFullscreen
                        brandName="iPhone"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Specs", id: "metrics" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Premium Technology"
                        bottomRightText="hello@iphone.shop"
                    />

                    {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 News"
                            description="Stay updated with the latest iPhone insights, reviews, and technology updates"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterBase
                        logoText="iPhone"
                        copyrightText="© 2025 iPhone Sales. All rights reserved."
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "iPhone 15 Pro", href: "#products" },
                                    { label: "iPhone 15 Pro Max", href: "#products" },
                                    { label: "iPhone 15", href: "#products" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Warranty", href: "#faq" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "https://apple.com" },
                                    { label: "Privacy Policy", href: "https://apple.com/privacy" },
                                    { label: "Terms of Service", href: "https://apple.com/legal" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}