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

export default async function ProfileLeaguesPage() {
  const result = await ProfileLeaguesPageQuery.execute();

  switch (result.status) {
    case 'notFound':
      notFound();
    case 'redirect':
      // Note: In Next.js, redirect would be imported from next/navigation
      // For now, we'll handle this case by returning notFound
      // In a full implementation, you'd use: redirect(result.to);
      notFound();
    case 'error':
      // For now, treat errors as notFound
      // In a full implementation, you might render an error page
      notFound();
    case 'ok':
      return <ProfileLeaguesPageClient pageDto={result.dto} />;
  }
}