import { getCandidateCallStatus } from "../../../../utils/election/index.js";
import ElectionIcon from "../../ElectionIcon/index.js";
import { useResults } from "../../../../hooks/election/index.js";
import classnames from 'classnames';
import classes from './styles.module.scss';
const iconMap = {
  'no-call': 'CandidateSwatch',
  winner: 'OutcomeWin',
  runoff: 'CandidateSwatch'
};
const iconSizes = {
  'no-call': '2',
  winner: '3',
  runoff: '2'
};
const CandidateIcon = function CandidateIcon(props) {
  const {
    candidateId,
    id
  } = props;
  const results = useResults(id);
  const candidateStatus = getCandidateCallStatus(results, candidateId);
  const iconType = iconMap[candidateStatus] || 'CandidateSwatch';
  const iconSize = iconSizes[candidateStatus];
  return <span className={classnames(classes.container)}>
      <ElectionIcon type={iconType} size={iconSize} color="currentColor" />
    </span>;
};
export default CandidateIcon;