'use client';
import PatientList from '@/app/components/Patient/PatientList';
import { useAuthStore } from '@/lib/auth-store';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';

export default function PatientsPage() {
  const router = useRouter();
  const { user } = useAuthStore();

  useEffect(() => {
    if (user?.userType === 'admin') {
      router.push('/dashboard');
    }
  }, [user, router]);

  if (user?.userType === 'admin') {
    return null;
  }

  return <PatientList />;
}
