import PropTypes from 'prop-types';
import useContestMetadata from "../../../hooks/election/useContestMetadata/index.js";

/**
 * A custom note for a contest that provides some important context, like that
 * the contest has gone through an instant runoff or that there's some other
 * kind of bizarre situation.
 */
const ContestNote = function ContestNote(props) {
  const {
    id
  } = props;
  const metadata = useContestMetadata(id);
  if (!metadata || !metadata.note) return null;
  return <>
      {metadata.note}
    </>;
};
ContestNote.defaultProps = {};
ContestNote.propTypes = {
  /**
   * The ID of the contest whose note you want to print.
   */
  id: PropTypes.string.isRequired
};
export default ContestNote;