import React from 'react';
import { SidebarTrigger } from "./components/ui/sidebar"
import type { WawpDashboardData } from './types';
import GlobalSearch from './components/common/GlobalSearch';
import AIGlobalAssistant from './components/common/AIGlobalAssistant';

interface TopbarProps {
  data: WawpDashboardData;
}

const Topbar: React.FC<TopbarProps> = ({ data }) => {
    const { sidebarData, i18n, global, rtl } = data;
  const isProStatus = sidebarData.isPro;
  const statusLabel = isProStatus ? (i18n.proVersion || 'Pro') : (i18n.freeVersion || 'Free');
  const versionText = i18n.labelVersion || 'Version';

  return (
    <div className="wawp_top-bar flex items-center justify-between px-4 py-2 bg-[#044] text-white z-50">
      <div className="flex items-center gap-4">
        <SidebarTrigger className="text-white hover:bg-white/10" />
        <div className="flex items-center gap-2">
          <span className="text-xs font-medium opacity-80">{String(versionText)} {String(statusLabel)} {global.version}</span>
        </div>
      </div>

      <div className="flex items-center gap-4">
        <AIGlobalAssistant data={data} />
        <GlobalSearch rtl={rtl} />
      </div>
    </div>
  );
};

export default Topbar;
