'use client';

import { useAuth } from '@/hooks/useAuth';
import { useRouter } from 'next/navigation';

export default function Header() {
  const { user, logout } = useAuth();
  const router = useRouter();

  const handleLogout = () => {
    logout();
    router.push('/login');
  };

  return (
    <header>
      <div className="header-content">
        <span className="badge">Menu de Aplicaciones</span>
        <div className="user-info">
          <span className="user-name">
            <i className="fas fa-user"></i> {user?.nombre || 'Usuario'}
          </span>
          <button className="btn-logout" onClick={handleLogout}>
            <i className="fas fa-sign-out-alt"></i> Cerrar Sesión
          </button>
        </div>
      </div>
    </header>
  );
}
