import { useContestSummaryResults } from "../../../../hooks/election/index.js";
import Recount from './Recount';
import Runoff from './Runoff';
import Standard from './Standard';
import Winner from './Winner';
import TooEarly from './TooEarly';
import NoData from './NoData';
import Flip from './Flip';
import Uncontested from './Uncontested';
import useCandidatesToShow from '../useCandidatesToShow';
const Results = function Results(props) {
  const {
    contestId
  } = props;
  const summary = useContestSummaryResults(contestId);
  const {
    candidatesToShow,
    layout
  } = useCandidatesToShow(contestId);
  if (!summary) {
    return null;
  }
  const layouts = {
    runoff: Runoff,
    standard: Standard,
    winner: Winner,
    recount: Recount,
    'too-early': TooEarly,
    flip: Flip,
    'no-data': NoData,
    uncontested: Uncontested
  };
  const Layout = layouts[layout];
  if (!Layout) return null;
  return <Layout candidatesToShow={candidatesToShow} contestId={contestId} />;
};
export default Results;