const delegates = function delegates(data) {
  const {
    parties
  } = data;
  return {
    ...data,
    parties: parties.map(party => {
      const {
        candidates,
        states
      } = party;
      return {
        ...party,
        candidates: candidates.map(c => ({
          ...c,
          id: `cycle:candidate:${c.id}`
        })),
        states: states.map(state => ({
          ...state,
          candidates: state.candidates.map(c => ({
            ...c,
            id: `cycle:candidate:${c.id}`
          }))
        }))
      };
    })
  };
};
export default delegates;