import React from 'react';
import {TournamentPredictionResponse} from '@modules/prodev2/interfaces';

import {PodiumPreviewCard} from '../PodiumPreviewCard';
import {PodiumEmptyCard} from './components/PodiumEmptyCard';

export interface PodiumCardProps {
  tournamentPrediction: TournamentPredictionResponse;
  deadline?: string;
  onPress?: () => void;
}

export function PodiumCard({
  tournamentPrediction,
  deadline,
  onPress,
}: PodiumCardProps) {
  if (!tournamentPrediction.isOpen) {
    return null;
  }

  if (tournamentPrediction.prediction) {
    return (
      <PodiumPreviewCard
        tournamentPrediction={tournamentPrediction}
        deadline={deadline}
        onPress={onPress}
      />
    );
  }

  return <PodiumEmptyCard deadline={deadline} onPress={onPress} />;
}

export default PodiumCard;
