import { redirect } from 'next/navigation';
import { cookies } from 'next/headers';

/**
 * Root page - redirects to /chat if authenticated, /login if not
 */
export default async function Home() {
  const cookieStore = await cookies();
  const authCookie = cookieStore.get('ponderants-auth');

  if (authCookie) {
    redirect('/chat');
  } else {
    redirect('/login');
  }
}
