
const userMapper = user => ({
  lastName: user.name.familyName || null,
  firstName: user.name.givenName || null,
  email: user.emails && user.emails.length > 0 ? user.emails[0].value : null,
  displayName: user.displayName || null,
  picture: user.picture || null,
  gender: user.gender || null,
  locale: user.locale || null,
  clientID: user._json.clientID || null,
  updatedAT: user._json.updated_at || null,
  userID: user.identities && user.identities.length > 0
    ? user.identities[0].user_id + user.identities[0].provider
    : null,
  nickname: user.nickname || null,
  provider: user.provider || null,
  isSocial: user.identities && user.identities.length > 0 ? user.identities[0].isSocial : false,
  token: user.token ? user.token : null,
});

// TODO fix user id
export default { userMapper };
