import { selectorFamily } from 'recoil';
import cycleCandidateMetadataAtom from '../atoms/cycleCandidateMetadata';

/**
 * Candidate metadata can either be hydrated by a candidate collection or
 * a single-candidate metadata file. (In practice, this is always hydrated by
 * a candidate collection.)
 */
const cycleCandidateMetadata = selectorFamily({
  key: 'election.selectors.cycleCandidateMetadata',
  get: key => ({
    get
  }) => {
    const atom = cycleCandidateMetadataAtom(key);
    return get(atom);
  }
});
export default cycleCandidateMetadata;