'use client';

import { Card } from '@/ui/Card';
import { useTeamStandings } from "@/hooks/team/useTeamStandings";
import { Box } from '@/ui/Box';
import { Heading } from '@/ui/Heading';
import { StandingsList } from '@/ui/StandingsList';
import { LoadingWrapper } from '@/components/shared/state/LoadingWrapper';
import { EmptyState } from '@/components/shared/state/EmptyState';
import { Trophy } from 'lucide-react';

interface TeamStandingsProps {
  teamId: string;
  leagues: string[];
}

export function TeamStandings({ teamId, leagues }: TeamStandingsProps) {
  const { data: standings = [], isLoading: loading } = useTeamStandings(teamId, leagues);

  if (loading) {
    return (
      <Card>
        <LoadingWrapper message="Loading standings..." />
      </Card>
    );
  }

  return (
    <Card>
      <Box mb={6}>
        <Heading level={2}>
          League Standings
        </Heading>
      </Box>
      
      {standings.length > 0 ? (
        <StandingsList standings={standings} />
      ) : (
        <EmptyState
          icon={Trophy}
          title="No standings available"
          description="This team hasn't participated in any leagues yet."
        />
      )}
    </Card>
  );
}
