import Container from '@/components/shared/Container'
import DoubleSidedImage from '@/components/shared/DoubleSidedImage'
import { Button } from '@/components/ui'
import { ROUTES_ENUM } from '@/routes/route.constant'
import { useLocalization } from '@/utils/hooks/useLocalization'
import { Helmet } from 'react-helmet'
import { FaArrowLeft } from 'react-icons/fa';
import { useNavigate } from 'react-router-dom'

const AccessDenied = () => {
  const navigate = useNavigate()
  const { translate } = useLocalization()

  const currentPath = location.pathname
  const isAdminPath = currentPath.startsWith('/admin')

  return (
    <Container className="h-full">
      <Helmet
        titleTemplate="%s | Sözsoft Kurs Platform"
        title={translate('::' + 'Access Denied')}
        defaultTitle="Sözsoft Kurs Platform"
      ></Helmet>
      <div className="h-full flex flex-col items-center justify-center p-28">
        <DoubleSidedImage
          src="/img/others/img-2.png"
          darkModeSrc="/img/others/img-2-dark.png"
          alt={translate('::AccessDenied')}
        />
        <div className="mt-6 text-center">
          <h3 className="mb-2">{translate('::AccessDenied')}</h3>
          <p className="text-base">{translate('::AccessDeniedMessage')}</p>
        </div>
        <Button
          size="xs"
          className="mt-2"
          variant="default"
          onClick={() =>
            navigate(isAdminPath ? ROUTES_ENUM.protected.dashboard : ROUTES_ENUM.public.home)
          }
        >
          <FaArrowLeft />
        </Button>
      </div>
    </Container>
  )
}

export default AccessDenied
