/**
 * Utility to determine if a contest's status is considered "unclear" for the purpose
 * of display on maps or other graphics
 *
 * @param {ContestStatus}  // The current status object of a contest
 *
 */
const getContestStatusIsUnclear = function getContestStatusIsUnclear(contestStatus) {
  if (!contestStatus) {
    return true;
  }
  const {
    winningCandidate,
    leadingCandidate
  } = contestStatus;
  if (winningCandidate) {
    return false;
  }
  const tooEarly = contestStatus.tabulation === 'before' || contestStatus.tabulation === 'noData' || contestStatus.tabulation === 'tooEarly';
  const noLeader = !winningCandidate && !leadingCandidate;
  const unclearCounty = contestStatus === 'unclear';
  return tooEarly || contestStatus.isTied || noLeader || unclearCounty;
};
export default getContestStatusIsUnclear;