import getFormats from './getFormats';

/**
 * Format the text of the contest vote tabulation progress.
 *
 * @param {'eevp'|'precinctsReporting'} options.mode
 *   The mode of tabulation progress representation
 * @param {number} options.pct
 *   The percent of votes/precincts counted, between 0 and 1
 * @param {string} options.tabulation
 *   The tabulation status of the contest
 * @param {'short'|'full'} options.format
 *   The format of the label
 * @returns {Object}
 */
const formatProgress = function formatProgress({
  format,
  progress,
  status
}) {
  const formats = getFormats({
    progress,
    status
  });
  const text = typeof formats[format] === 'undefined' ? formats.short : formats[format];
  return {
    className: 'active',
    text
  };
};
export default formatProgress;