def build_offline_user_data_job_operations(client, customer_data):
  """Builds the schema of user data as defined in the API.

  Args:
    client: The Google Ads client.
    customer_data: Processed customer data to be uploaded.

  Returns:
    A list containing the operations.
  """

  customer_data_operations = []

  for data_type in customer_data:
    for item in customer_data[data_type]:
      # Creates a first user data based on an email address.
      user_data_operation = client.get_type('OfflineUserDataJobOperation')
      user_data = user_data_operation.create
      user_identifier = client.get_type('UserIdentifier')

      if data_type == 'emails':
        user_identifier.hashed_email = item['hashed_email']
      elif data_type == 'phones':
        user_identifier.hashed_phone_number = item['hashed_phone_number']
      elif data_type == 'mobile_ids':
        user_identifier.mobile_id = item['mobile_id']
      elif data_type == 'user_ids':
        user_identifier.third_party_user_id = item['third_party_user_id']
      elif data_type == 'addresses':
        user_identifier.address_info.hashed_first_name = item[
            'hashed_first_name']
        user_identifier.address_info.hashed_last_name = item['hashed_last_name']
        user_identifier.address_info.country_code = item['country_code']
        user_identifier.address_info.postal_code = item['postal_code']
      user_data.user_identifiers.append(user_identifier)

      customer_data_operations.append(user_data_operation)

  return customer_data_operations