api.user do
  api.id         @user.id
  api.login      @user.login
  api.admin      @user.admin?
  api.firstname  @user.firstname
  api.lastname   @user.lastname
  api.mail       @user.mail
  api.language   @user.language || "en"
  api.default_language Setting.default_language
  api.created_on @user.created_on
  api.last_login_on @user.last_login_on
  api.api_key    @user.api_key
  api.supervisor @user&.supervisor&.name

  #api.wk_user @user&.erpmineuser
  api.wk_user do
    api.id @user&.erpmineuser&.id
    api.role @user&.erpmineuser&.role&.name
    api.shift @user&.erpmineuser&.shift&.name
    api.location @user&.erpmineuser&.location&.name
    api.department @user&.erpmineuser&.department&.name
    api.dept_section_id @user&.erpmineuser&.dept_section&.name
    api.billing_rate @user&.erpmineuser&.billing_rate
    api.is_schedulable @user&.erpmineuser&.is_schedulable
    api.billing_currency @user&.erpmineuser&.billing_currency
    api.join_date @user&.erpmineuser&.join_date
    api.birth_date @user&.erpmineuser&.birth_date
    api.termination_date @user&.erpmineuser&.termination_date
    api.marital_id @user&.erpmineuser&.marital&.name
	  api.emergency_contact @user&.erpmineuser&.emergency_contact
	  api.emerg_type_id @user&.erpmineuser&.emerg_type&.name
	  api.state_insurance @user&.erpmineuser&.state_insurance
	  api.employee_id @user&.erpmineuser&.employee_id
    api.gender @user&.erpmineuser&.gender
    api.custom_date1 @user&.erpmineuser&.custom_date1
    api.custom_date2 @user&.erpmineuser&.custom_date2
    api.bank_name @user&.erpmineuser&.bank_name
    api.account_number WkUser.decrypt_user_credentials(@user&.id, 'account_number')
    api.bank_code @user&.erpmineuser&.bank_code
    api.tax_id WkUser.decrypt_user_credentials(@user&.id, 'tax_id')
    api.ss_id WkUser.decrypt_user_credentials(@user&.id, 'ss_id')
    api.retirement_account @user&.erpmineuser&.retirement_account
    api.encrypt_tax_id WkUser.show_data(@user&.id, 'tax_id')
    api.encrypt_ss_id WkUser.show_data(@user&.id, 'ss_id')
    api.encrypt_account_number WkUser.show_data(@user&.id, 'account_number')
    api.id1 @user&.erpmineuser&.id1
    api.id2 @user&.erpmineuser&.id2
    api.id3 @user&.erpmineuser&.id3
    api.custom_number1 @user&.erpmineuser&.custom_number1
    api.custom_number2 @user&.erpmineuser&.custom_number2
    api.notes @user&.erpmineuser&.notes
    api.address @user&.erpmineuser&.address
  end
  render_api_custom_values @user.visible_custom_field_values, api
end

genderItems = {M: l(:gender_hash_male), F: l(:gender_hash_female), O: l(:gender_hash_others)}
api.headers do
  api.language_items languages_options
  api.gender_items genderItems
  api.force_default_language Setting.force_default_language_for_loggedin?
end
