/**
 * These options define what we hide, or shorten, depending on a results
 * table's given format, or its container's size. We also adjust the results
 * table's text size based on its container size but this is done via scss, and
 * each component that needs to do so should refer to the size prop returned by
 * the results table's context.
 */

/**
 * Our default options are to show everything, in its longest format
 * @property {string}  contestNameFormat       - The format passed to the `ContestName` component
 * @property {string}  candidateNameFormat     - The format passed to the `CandidateName` component
 * @property {string}  voteInFormat            - The format passed to the `ResultsVoteIn` component
 * @property {boolean} showVotes               - Whether to show the total votes column
 * @property {boolean} showRecountStatus       - Whether to show when a recount is complete
 * @property {boolean} showRating              - Whether to show a contest's election forecast rating
 * @property {boolean} showPolarity            - Whether to show a candidate's polarity in a parenthetical
 * @property {boolean} showContestDescription  - Whether to show a contest's description
 * @property {boolean} contestTypeFormat       - The format passed to the `ContestType` component
*/
const defaultOptions = {
  contestNameFormat: 'long',
  candidateNameFormat: 'full',
  voteInFormat: 'full',
  showVotes: true,
  showRecountStatus: true,
  showRating: true,
  showPolarity: true,
  showContestDescription: true,
  contestTypeFormat: 'full',
  showBar: true
};
const defaultSizeOverrides = {
  small: {
    contestNameFormat: 'short',
    candidateNameFormat: 'short',
    voteInFormat: 'short',
    showVotes: false,
    showRecountStatus: false,
    showRating: false,
    showPolarity: false,
    contestTypeFormat: 'party-only'
  },
  medium: {
    contestNameFormat: 'medium',
    voteInFormat: 'short',
    candidateNameFormat: 'short',
    contestTypeFormat: 'party-only'
  },
  large: {
    // Show everything as defined by the format
  }
};

/**
 * Our standard format follows our defaults, but our
 * condensed format overrides certain variables
 */
const optionsByFormat = {
  standard: {
    ...defaultOptions
  },
  condensed: {
    ...defaultOptions,
    voteInFormat: 'short',
    showVotes: false,
    showRecountStatus: false,
    showRating: false,
    showPolarity: false,
    showContestDescription: false,
    showBar: false
  }
};

/**
 * Since size options end up overriding the default format options,
 * they should only ever be hiding something, or making it shorter
 */
const optionsBySize = {
  standard: {
    ...defaultSizeOverrides
  },
  condensed: {
    ...defaultSizeOverrides,
    medium: {
      ...defaultSizeOverrides.medium,
      candidateNameFormat: 'full'
    }
  }
};
export { defaultOptions, optionsBySize, optionsByFormat };