"use client";

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

const handlePrivacy = () => {
    console.log("Privacy clicked");
};

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="reveal-blur"
            borderRadius="pill"
            contentWidth="smallMedium"
            sizing="mediumLarge"
            background="none"
            cardStyle="solid"
            primaryButtonStyle="gradient"
            secondaryButtonStyle="glass"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleFullscreen
                        brandName="iPhone"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Products", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Pricing", id: "pricing" },
                            { name: "Contact", id: "contact" },
                            { name: "Support", id: "support" }
                        ]}
                        bottomLeftText="Premium Devices"
                        bottomRightText="shop@iphone.com"
                    />

                    {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 & Updates"
                            description="Discover the latest insights, features, and innovations in iPhone technology"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    )}

                    <FooterBaseCard
                        logoText="iPhone"
                        columns={[
                            {
                                title: "Products",                                items: [
                                    { label: "iPhone Pro Max", href: "#products" },
                                    { label: "iPhone Pro", href: "#products" },
                                    { label: "iPhone Standard", href: "#products" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Help & Support", href: "#support" },
                                    { label: "Warranty", href: "#warranty" },
                                    { label: "Returns", href: "#returns" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Blog", href: "#blog" },
                                    { label: "Careers", href: "#careers" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Contact Us", href: "#contact" },
                                    { label: "Newsletter", href: "#newsletter" },
                                    { label: "Community", href: "#community" }
                                ]
                            }
                        ]}
                        copyrightText="© 2025 iPhone. All rights reserved."
                        onPrivacyClick={handlePrivacy}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}