"use client";

import ReactLenis from "lenis/react";
import BlogCardThree from '@/components/sections/blog/BlogCardThree';
import FooterBase from '@/components/sections/footer/FooterBase';
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="shift-hover"
            defaultTextAnimation="background-highlight"
            borderRadius="pill"
            contentWidth="mediumLarge"
            sizing="medium"
            background="circleGradient"
            cardStyle="gradient-radial"
            primaryButtonStyle="primary-glow"
            secondaryButtonStyle="glass"
            headingFontWeight="light"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="iPhone Store"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Specs", id: "specs" },
                            { name: "Reviews", id: "testimonials" },
                            { name: "Pricing", id: "pricing" },
                            { name: "FAQ", id: "faq" }
                        ]}
                        button={{
                            text: "Buy Now",                            href: "pricing"
                        }}
                    />

                    {isLoading ? (
                        <div className="w-content-width mx-auto py-20 text-center">
                            <p className="text-foreground">Loading posts...</p>
                        </div>
                    ) : (
                        <BlogCardThree
                            blogs={posts}
                            title="iPhone Insights & Updates"
                            description="Stay informed about the latest iPhone technologies, features, and innovations"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            animationType="slide-up"
                            carouselMode="buttons"
                            tag="Tech Blog"
                        />
                    )}

                    <FooterBase
                        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: "iPhone SE", href: "products" },
                                    { label: "Compare Models", href: "specs" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Product Specs", href: "specs" },
                                    { label: "FAQ", href: "faq" },
                                    { label: "Warranty Info", href: "faq" },
                                    { label: "Contact Us", href: "contact" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "https://example.com/about" },
                                    { label: "Blog", href: "https://example.com/blog" },
                                    { label: "Careers", href: "https://example.com/careers" },
                                    { label: "Sustainability", href: "https://example.com/sustainability" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}