"use client";

import ReactLenis from "lenis/react";
import BlogCardTwo from '@/components/sections/blog/BlogCardTwo';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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-shift"
            defaultTextAnimation="entrance-slide"
            borderRadius="sharp"
            contentWidth="mediumSmall"
            sizing="largeSmall"
            background="none"
            cardStyle="soft-shadow"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleApple
                        brandName="iPhone Store"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Pricing", id: "pricing" },
                            { name: "About", id: "about" },
                            { name: "Contact", id: "contact" }
                        ]}
                    />

                    {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 Store Blog"
                            description="Stay updated with the latest iPhone news, reviews, and technical insights from our experts"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterSimple
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "iPhone 15", href: "#products" },
                                    { label: "iPhone 15 Pro", href: "#products" },
                                    { label: "iPhone 15 Pro Max", href: "#products" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "FAQ", href: "#" },
                                    { label: "Shipping", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About", href: "#about" },
                                    { label: "Blog", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Cookie Policy", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 iPhone Store. All rights reserved."
                        bottomRightText="Authorized Apple Retailer"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}