//====================================
// File: Navbar.tsx
// componente Navbar
// @author: "villari.andrea@libero.it"
// @version: "1.0.0 2026-05-07"
//====================================
"use client"
import { ReactNode} from "react";
import Link from "next/link"; 
import Image from "next/image";
import GlobalStabilimentoSelector from "./GlobalStabilimentoSelector";

interface NavLink {
    href: string;
    label: string;
}

const navLinks: NavLink[] = [
    { href: "/", label: "Home"},
    { href: "/movimenti", label: "Movimenti"},
    { href: "/articoli", label: "Articoli"},
    { href: "/macchine", label: "Macchine"},
    { href: "/utenti", label: "Utenti"},
];

export default function Navbar({ actions }: { actions?: ReactNode }) {
    return (
        <nav className="border-b border-zinc-800 bg-black">
            <div className="max-w-7xl mx-auto px-4">
                <div className="flex items-center justify-between h-32">
                    {/* Logo */}
                    <Link
                        href="/"
                        className="flex items-center hover:opacity-80 transition-opacity"
                    >
                        <Image
                            src="/immagini/Logo.webp"
                            alt="MagRicambi"
                            width={480}
                            height={120}
                            priority
                            className="h-28 w-auto"
                        />
                    </Link>

                    {/* Navigation Links */}
                    <div className="flex items-center space-x-6">
                        {navLinks.map((link) => (
                            <Link
                                key={link.href}
                                href={link.href}
                                className="text-sm text-zinc-300 hover:text-zinc-100 transition-colors"
                            >
                                {link.label}
                            </Link>
                        ))}
                    </div>

                    {/* Stabilimento Selector */}
                    <div className="flex-1 flex justify-center px-4">
                        <GlobalStabilimentoSelector />
                    </div>

                    {/* Actions */}
                    {actions ? (
                        <div className="flex items-center">
                            {actions}
                        </div>
                    ) : null}
                </div>
            </div>
        </nav>
    );
}
