import { auth } from '@/auth';
import { redirect } from 'next/navigation';
import { Button } from '@/components/ui/Buttons';
import Link from 'next/link';

export default async function Unauthorized() {
	const session = await auth();
	// redirect to home if user is already logged in
	if (session?.user) {
		redirect('/');
	}

	return (
		<div className="flex flex-col h-[calc(100vh-theme(spacing.16))] items-center justify-center py-10 space-y-2">
			<div>
				You are not authorized to view this page. Please sign in with Landing
				account to continue.
			</div>
			<Button asChild className="mt-16">
				<Link href="/sign-in">Sign in</Link>
			</Button>
		</div>
	);
}
