import Tooltip from '@/components/ui/Tooltip'
import { ROUTES_ENUM } from '@/routes/route.constant'
import { useLocalization } from '@/utils/hooks/useLocalization'
import { usePermission } from '@/utils/hooks/usePermission'
import { FaHeadset } from 'react-icons/fa';
import { useNavigate } from 'react-router-dom'

const AiAssistant = () => {
  const { translate } = useLocalization()
  const navigate = useNavigate()
  const { checkPermissions } = usePermission()

  const canViewAi = checkPermissions(['Abp.Identity.Ai'])

  if (!canViewAi) {
    return null
  }
  
  return (
    <>
      <Tooltip title={translate('::Abp.Identity.Ai')}>
        <div
          onClick={() => navigate(ROUTES_ENUM.protected.admin.ai)}
          className="flex items-center justify-center w-9 h-9 m-2 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors duration-200"
        >
          <FaHeadset size={28} />
        </div>
      </Tooltip>
    </>
  )
}

export default AiAssistant
