ident = {
  id: identity.public_id
}

scope "verification_status", identity: do
  ident[:ysws_eligible] = identity.ysws_eligible
  ident[:verification_status] = identity.verification_status
end

scope "basic_info", identity: do
  ident[:first_name] = identity.first_name
  ident[:last_name] = identity.last_name
  ident[:primary_email] = identity.primary_email
  ident[:slack_id] = identity.slack_id
  ident[:primary_email] = identity.primary_email
  ident[:phone_number] = identity.phone_number
  ident[:ysws_eligible] = identity.ysws_eligible
  ident[:verification_status] = identity.verification_status
  ident[:verification_status_reason] = identity.verification_status_reason
  ident[:rejection_reason] = identity.verification_status_reason
  ident[:rejection_reason_details] = identity.verification_status_reason_details
  ident[:birthday] = identity.birthday
end

scope "email", identity: do
  ident[:primary_email] = identity.primary_email
end

scope "name", identity: do
  ident[:first_name] = identity.first_name
  ident[:last_name] = identity.last_name
end

scope "slack_id", identity: do
  ident[:slack_id] = identity.slack_id
end

scope "legal_name", identity: do
  ident[:legal_first_name] = identity.legal_first_name
  ident[:legal_last_name] = identity.legal_last_name
end

scope "birthdate", identity: do
  ident[:birthday] = identity.birthday
end

scope "address", identity: do
  ident[:addresses] = identity.addresses.map do |address|
    render address
  end
end

ident.compact_blank
