import {UserRole} from '@prisma/client'
import {notFound} from 'next/navigation'

import {auth} from '@/auth'
import LoginForm from '@/components/auth/forms/login-form'
import {SessionUser} from '@/types/auth'

export default async function AdminPermission() {
	const session = await auth()
	const user: SessionUser = session?.user as unknown as SessionUser

	if (!user) {
		return (
			<div className='my-8'>
				<div className='container flex flex-col sm:flex-row'>
					<LoginForm />
				</div>
			</div>
		)
	}

	//if (![UserRole.CUSTOMER].includes(user.role as 'CUSTOMER')) {
	if (user.role !== UserRole.SUPERVISOR) {
		notFound()
	}
}
