import get from 'lodash/get';
import autohed from './autohed';
import getIsTied from './getIsTied';
import getIsFinal from './getIsFinal';
const bodyDek = function bodyDek(opts) {
  const {
    office,
    bop
  } = opts;
  const winnerParty = get(bop, 'winner.party');
  const isWinner = !!winnerParty;
  const isTied = getIsTied(bop);
  const isFinal = getIsFinal(bop);
  if (office === 'senate') {
    if (isTied && isFinal && !isWinner) {
      return autohed`The winner of the White House will determine who controls the chamber.`;
    }
  }
  return undefined;
};
export default bodyDek;