"use client";

import ReactLenis from "lenis/react";
import BlogCardOne from "@/components/sections/blog/BlogCardOne";
import FooterMedia from '@/components/sections/footer/FooterMedia';
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="directional-hover"
            defaultTextAnimation="reveal-blur"
            borderRadius="rounded"
            contentWidth="smallMedium"
            sizing="mediumLargeSizeMediumTitles"
            background="floatingGradient"
            cardStyle="inset"
            primaryButtonStyle="diagonal-gradient"
            secondaryButtonStyle="layered"
            headingFontWeight="medium"
        >
            <ReactLenis root>
                <div id="nav" data-section="nav">
                    <NavbarStyleFullscreen
                        navItems={[
                            { name: "Home", id: "/" },
                            { name: "About", id: "about" },
                            { name: "Experience", id: "features" },
                            { name: "Visit", id: "contact" },
                            { name: "Connect", id: "newsletter" }
                        ]}
                        brandName="Fix Coffee"
                        bottomLeftText="Quiet spaces for creative minds"
                        bottomRightText="hello@fixcoffee.local"
                    />
                </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">
                        <BlogCardOne
                            blogs={posts}
                            title="Coffee Culture Stories"
                            description="Discover insights, tips, and stories from our creative community"
                            textboxLayout="default"
                            useInvertedBackground="noInvert"
                            carouselMode="buttons"
                            animationType="slide-up"
                        />
                    </div>
                )}

                <div id="footer" data-section="footer">
                    <FooterMedia
                        imageSrc="https://img.b2bpic.net/free-photo/team-young-colleagues-having-meeting-cafe_273609-16250.jpg"
                        imageAlt="Fix Coffee community gathering"
                        logoText="Fix Coffee"
                        copyrightText="© 2025 Fix Coffee. Brewed with care for creative minds."
                        columns={[
                            {
                                title: "Explore",                                items: [
                                    { label: "About Us", href: "#about" },
                                    { label: "Experience", href: "#features" },
                                    { label: "Gallery", href: "#gallery" }
                                ]
                            },
                            {
                                title: "Connect",                                items: [
                                    { label: "Email Us", href: "mailto:hello@fixcoffee.local" },
                                    { label: "Instagram", href: "https://instagram.com" },
                                    { label: "Community Events", href: "#" }
                                ]
                            },
                            {
                                title: "Hours",                                items: [
                                    { label: "Mon–Fri: 7am–8pm", href: "#" },
                                    { label: "Sat–Sun: 8am–9pm", href: "#" },
                                    { label: "Closed: Holiday", href: "#" }
                                ]
                            }
                        ]}
                    />
                </div>
            </ReactLenis>
        </ThemeProvider>
    );
}