"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 NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useBlogPosts } from "@/hooks/useBlogPosts";

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

    return (
        <ThemeProvider
            defaultButtonVariant="text-shift"
            defaultTextAnimation="background-highlight"
            borderRadius="sharp"
            contentWidth="medium"
            sizing="mediumLargeSizeLargeTitles"
            background="floatingGradient"
            cardStyle="elevated"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="extrabold"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "Shop", id: "products" },
                            { name: "About", id: "about" },
                            { name: "Features", id: "features" },
                            { name: "Testimonials", id: "testimonials" },
                            { name: "Contact", id: "contact" }
                        ]}
                        brandName="Stringed Harmony"
                        bottomLeftText="For Musicians, By Musicians"
                        bottomRightText="hello@stringedharmony.com"
                    />
                </div>

                {isLoading ? (
                    <div className="w-content-width mx-auto py-20 text-center">
                        <p className="text-foreground">Loading posts...</p>
                    </div>
                ) : (
                    <div id="blog" data-section="blog">
                        <BlogCardTwo
                            blogs={posts}
                            title="Guitar Knowledge & Tips"
                            description="Expert insights, maintenance tips, and stories from the world of stringed instruments"
                            textboxLayout="default"
                            useInvertedBackground={false}
                            carouselMode="buttons"
                            animationType="slide-up"
                            tag="Blog"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterSimple
                        columns={[
                            {
                                title: "Shop",                                items: [
                                    { label: "Acoustic Guitars", href: "#" },
                                    { label: "Electric Guitars", href: "#" },
                                    { label: "Bass Guitars", href: "#" },
                                    { label: "Accessories", href: "#" }
                                ]
                            },
                            {
                                title: "Company",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Our Story", href: "#" },
                                    { label: "Expert Team", href: "#" },
                                    { label: "Careers", href: "#" }
                                ]
                            },
                            {
                                title: "Support",                                items: [
                                    { label: "Contact", href: "#contact" },
                                    { label: "FAQ", href: "#faq" },
                                    { label: "Setup Guide", href: "#" },
                                    { label: "Warranty", href: "#" }
                                ]
                            },
                            {
                                title: "Legal",                                items: [
                                    { label: "Privacy Policy", href: "#" },
                                    { label: "Terms of Service", href: "#" },
                                    { label: "Return Policy", href: "#" },
                                    { label: "Shipping Info", href: "#" }
                                ]
                            }
                        ]}
                        bottomLeftText="© 2025 Stringed Harmony. All rights reserved."
                        bottomRightText="Crafted for Musicians, By Musicians"
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}