// eslint-disable-next-line validate-filename/naming-rules
'use client'

import { Button } from '@/components/ui/button'
import Link from 'next/link'
import { USER_PROFILE_URL } from '@/config/routes'
import { usePathname } from 'next/navigation'
import UserButton from '@/components/auth/user-button'
import LocaleSwitcher from '@/components/locale-switcher'

const Navbar = () => {
  const pathname = usePathname()
  //
  return (
    <nav className="bg-secondary flex justify-between items-center top-0 absolute px-6 py-4 w-full shadow-sm">
      <div className="flex gap-x-4">
        <Button asChild variant={pathname.match(/^\/(en\/|)server/) ? 'default' : 'outline'}>
          <Link href={'/server'}>
            Server
          </Link>
        </Button>
        <Button asChild variant={pathname.match(/^\/(en\/|)client/) ? 'default' : 'outline'}>
          <Link href={'/client'}>
            Client
          </Link>
        </Button>
        <Button asChild variant={pathname.match(/^\/(en\/|)admin/) ? 'default' : 'outline'}>
          <Link href={'/admin'}>
            Admin
          </Link>
        </Button>
        <Button asChild variant={pathname.match(/^\/(en\/|)cabinet/) ? 'default' : 'outline'}>
          <Link href={USER_PROFILE_URL}>
            Cabinet
          </Link>
        </Button>
      </div>
      <div className="flex gap-x-2">
        <LocaleSwitcher/>
        <UserButton/>
      </div>

    </nav>
  )
}

export default Navbar
