import { notFound } from 'next/navigation';
import { TeamsPageQuery } from '@/lib/page-queries/TeamsPageQuery';
import TeamsPageClient from './TeamsPageClient';

export default async function Page() {
  const result = await TeamsPageQuery.execute();

  switch (result.status) {
    case 'ok':
      return <TeamsPageClient pageDto={result.dto} />;
    case 'notFound':
      notFound();
    case 'redirect':
      // This would typically use redirect() from next/navigation
      // but we need to handle it at the page level
      return null;
    case 'error':
      // For now, treat errors as not found
      // In production, you might want a proper error page
      notFound();
  }
}