"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterLogoEmphasis from "@/components/sections/footer/FooterLogoEmphasis";
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="icon-arrow"
            defaultTextAnimation="entrance-slide"
            borderRadius="pill"
            contentWidth="small"
            sizing="largeSmallSizeLargeTitles"
            background="aurora"
            cardStyle="glass-depth"
            primaryButtonStyle="flat"
            secondaryButtonStyle="solid"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div className="min-h-screen bg-background">
                    <NavbarStyleCentered
                        brandName="iPhone Store"
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "Features", id: "features" },
                            { name: "Why Us", id: "metrics" },
                            { name: "FAQ", id: "faq" },
                            { name: "Contact", id: "contact" }
                        ]}
                        button={{
                            text: "Buy Now",                            href: "products"
                        }}
                    />

                    {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="Stay updated with the latest iPhone features, reviews, and technology insights from our expert team"
                            tag="Blog"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    )}

                    <FooterLogoEmphasis
                        logoText="iPhone Store"
                        columns={[
                            {
                                items: [
                                    { label: "Shop", href: "products" },
                                    { label: "Features", href: "features" },
                                    { label: "Pricing", href: "products" }
                                ]
                            },
                            {
                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Support", href: "contact" },
                                    { label: "Contact", href: "contact" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Privacy Policy", href: "#privacy" },
                                    { label: "Terms of Service", href: "#terms" },
                                    { label: "Warranty", href: "#warranty" }
                                ]
                            },
                            {
                                items: [
                                    { label: "Facebook", href: "https://facebook.com" },
                                    { label: "Twitter", href: "https://twitter.com" },
                                    { label: "Instagram", href: "https://instagram.com" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}