import PropTypes from 'prop-types';
import PrimaryCalendarHorizontal from './PrimaryCalendarHorizontal';
import PrimaryCalendarState from './PrimaryCalendarState';
import PrimaryCalendarVertical from './PrimaryCalendarVertical';

/**
 * The goal of this module is to show upcoming elections in a variety of
 * formats. It starts with the next upcoming election. This module can be
 * filtered to show only presidential or down-ballot races, or down to a single
 * state.
 */
const PrimaryCalendar = function PrimaryCalendar(props) {
  const {
    format,
    stateFips
  } = props;
  if (stateFips) {
    return <PrimaryCalendarState {...props} />;
  }
  if (format === 'horizontal') {
    return <PrimaryCalendarHorizontal {...props} />;
  }
  return <PrimaryCalendarVertical {...props} />;
};
PrimaryCalendar.defaultProps = {
  format: 'vertical',
  office: undefined,
  stateFips: undefined,
  overflow: false,
  wrap: undefined,
  disableLabels: false,
  limit: undefined,
  include: undefined,
  demConventionReporterNote: {},
  gopConventionReporterNote: {},
  tracking: {}
};
PrimaryCalendar.propTypes = {
  /**
   */
  format: PropTypes.oneOf(['vertical', 'horizontal']),
  /**
   * Which kinds of events to display. Leave undefined to display all events.
   */
  office: PropTypes.oneOf(['president', 'senate', 'house', 'governor', 'downBallot']),
  /**
   * Which state's calendar to render.
   */
  stateFips: PropTypes.string,
  /**
   * Enable overflow
   */
  overflow: PropTypes.bool,
  /**
   * Sets wrapping on per-state calendar
   */
  wrap: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['auto'])]),
  /**
   * Disbale labels for homepage
   */
  disableLabels: PropTypes.bool,
  /**
   * Limit how many days are displayed
   */
  limit: PropTypes.number,
  /**
   * The types of events to include in the calendar
   */
  include: PropTypes.arrayOf(PropTypes.oneOf(['convention', 'election'])),
  /**
   * A note about the democratic convention
   */
  demConventionReporterNote: PropTypes.shape({}),
  /**
   * A note about the republican convention
   */
  gopConventionReporterNote: PropTypes.shape({}),
  /**
   * Tracking options
   */
  tracking: PropTypes.shape({
    context: PropTypes.string
  })
};
export default PrimaryCalendar;