"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterSimple from '@/components/sections/footer/FooterSimple';
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="icon-arrow"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="medium"
            sizing="medium"
            background="aurora"
            cardStyle="elevated"
            primaryButtonStyle="double-inset"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleFullscreen
                        brandName="iPhone Store"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        bottomLeftText="Premium iPhone Selection"
                        bottomRightText="support@iphonestore.com"
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="Featured Articles"
                            description="Explore our latest insights and updates from the iPhone world"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            uniformGridCustomHeightClasses="min-h-[600px]"
                        />
                    )}

                    <FooterSimple
                        columns={[
                            {
                                title: "Products",                                items: [
                                    { label: "iPhone 15 Pro", href: "#products" },
                                    { label: "iPhone 15", href: "#products" },
                                    { label: "iPhone 14 Pro", href: "#products" },
                                    { label: "Compare", href: "#products" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Help Center", href: "#support" },
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "Warranty", href: "#support" },
                                    { label: "Trade-In", href: "#support" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Careers", href: "#careers" },
                                    { label: "Blog", href: "#blog" },
                                    { label: "Press", href: "#press" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy", href: "#privacy" },
                                    { label: "Terms", href: "#terms" },
                                    { label: "Cookies", href: "#cookies" },
                                    { label: "Accessibility", href: "#accessibility" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 iPhone Store. All rights reserved."
                        bottomRightText="Engineered with precision"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}