import { useContestMetadata } from "../../../../hooks/election/index.js";
import UncontestedRow from '../UncontestedRow';
import RegularRow from '../RegularRow';
import RowWrapper from '../RowWrapper';
const Row = function Row(props) {
  const {
    id,
    candidateId,
    idx
  } = props;
  const metadata = useContestMetadata(id);
  if (!metadata) {
    return null;
  }
  const {
    isUncontested
  } = metadata;
  const Layout = isUncontested ? UncontestedRow : RegularRow;
  return <RowWrapper key={candidateId} candidateId={candidateId} id={id} idx={idx}>
      <Layout id={id} candidateId={candidateId} idx={idx} />
    </RowWrapper>;
};
export default Row;