package org.silverpeas.mobile.shared.dto;

import static org.fusesource.restygwt.client.AbstractJsonEncoderDecoder.*;

public class DetailUserDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.DetailUserDTO> {
  
  public static final DetailUserDTO_Generated_JsonEncoderDecoder_ INSTANCE = new DetailUserDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.DetailUserDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeDetailUserDTO488339926(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeDetailUserDTO488339926( org.silverpeas.mobile.shared.dto.DetailUserDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.DetailUserDTO parseValue = (org.silverpeas.mobile.shared.dto.DetailUserDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getLastName()), rc, "lastName");
      isNotNullValuePut(STRING.encode(parseValue.geteMail()), rc, "eMail");
      isNotNullValuePut(STRING.encode(parseValue.getFirstName()), rc, "firstName");
      isNotNullValuePut(STRING.encode(parseValue.getAvatar()), rc, "avatar");
      isNotNullValuePut(STRING.encode(parseValue.getPhoneNumber()), rc, "phoneNumber");
      isNotNullValuePut(STRING.encode(parseValue.getCellularPhoneNumber()), rc, "cellularPhoneNumber");
      isNotNullValuePut(STRING.encode(parseValue.getFaxPhoneNumber()), rc, "faxPhoneNumber");
      isNotNullValuePut(STRING.encode(parseValue.getStatus()), rc, "status");
      isNotNullValuePut(STRING.encode(parseValue.getLanguage()), rc, "language");
      isNotNullValuePut(STRING.encode(parseValue.getToken()), rc, "token");
      isNotNullValuePut(STRING.encode(parseValue.getZone()), rc, "zone");
      isNotNullValuePut(STRING.encode(parseValue.getSessionKey()), rc, "sessionKey");
      isNotNullValuePut(BOOLEAN.encode(parseValue.getConnected()), rc, "connected");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isNotificationBox()), rc, "notificationBox");
      isNotNullValuePut(BOOLEAN.encode(parseValue.isLdap()), rc, "ldap");
      isNotNullValuePut(toJSON(parseValue.getProperties(), org.silverpeas.mobile.shared.dto.PropertyDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "properties");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.DetailUserDTO decode(com.google.gwt.json.client.JSONValue value) {
      if( value == null || value.isNull()!=null ) {
        return null;
      }
      com.google.gwt.json.client.JSONObject object = toObject(value);
        return decodeDetailUserDTO488339926(object);
      }
      
      private org.silverpeas.mobile.shared.dto.DetailUserDTO decodeDetailUserDTO488339926(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.DetailUserDTO rc = new org.silverpeas.mobile.shared.dto.DetailUserDTO();
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setLastName(getValueToSet(STRING.decode(object.get("lastName")), null));
        rc.seteMail(getValueToSet(STRING.decode(object.get("eMail")), null));
        rc.setFirstName(getValueToSet(STRING.decode(object.get("firstName")), null));
        rc.setAvatar(getValueToSet(STRING.decode(object.get("avatar")), null));
        rc.setPhoneNumber(getValueToSet(STRING.decode(object.get("phoneNumber")), null));
        rc.setCellularPhoneNumber(getValueToSet(STRING.decode(object.get("cellularPhoneNumber")), null));
        rc.setFaxPhoneNumber(getValueToSet(STRING.decode(object.get("faxPhoneNumber")), null));
        rc.setStatus(getValueToSet(STRING.decode(object.get("status")), null));
        rc.setLanguage(getValueToSet(STRING.decode(object.get("language")), null));
        rc.setToken(getValueToSet(STRING.decode(object.get("token")), null));
        rc.setZone(getValueToSet(STRING.decode(object.get("zone")), null));
        rc.setSessionKey(getValueToSet(STRING.decode(object.get("sessionKey")), null));
        rc.setConnected(getValueToSet(BOOLEAN.decode(object.get("connected")), false));
        rc.setNotificationBox(getValueToSet(BOOLEAN.decode(object.get("notificationBox")), false));
        rc.setLdap(getValueToSet(BOOLEAN.decode(object.get("ldap")), false));
        rc.setProperties(getValueToSet(toList(object.get("properties"), org.silverpeas.mobile.shared.dto.PropertyDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        return rc;
      }
      
    }
