export default function getNote({
  parties,
  isCaucus,
  officesDecided,
  notes,
}, perState = false) {
  const party = {
    gopOnly: 'GOP',
    demOnly: 'Dem',
  };
  if (notes !== '') {
    return notes;
  }
  if (isCaucus) {
    if (!party[parties]) {
      return 'Presidential caucuses';
    }
    return `${party[parties]} caucus`;
  }
  if (officesDecided === 'presidentialRaceOnly') {
    if (!party[parties]) {
      return 'Presidential primaries';
    }
    return `${party[parties]} presidential primary`;
  }
  if (perState) {
    if (parties === 'demAndGop') {
      return 'Dem, GOP downticket primaries';
    }
    if (officesDecided === 'downBallotRacesOnly' && parties === 'allPartyPrimary') {
      return 'Down-ticket all-party primaries';
    }
  }
  return undefined;
}
