package org.silverpeas.mobile.shared.dto.reservations;

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

public class ReservationDTO_Generated_JsonEncoderDecoder_ extends org.fusesource.restygwt.client.AbstractJsonEncoderDecoder<org.silverpeas.mobile.shared.dto.reservations.ReservationDTO> {
  
  public static final ReservationDTO_Generated_JsonEncoderDecoder_ INSTANCE = new ReservationDTO_Generated_JsonEncoderDecoder_();
  
  public com.google.gwt.json.client.JSONValue encode(org.silverpeas.mobile.shared.dto.reservations.ReservationDTO value) {
    if( value==null ) {
      return getNullType();
    }
      return encodeReservationDTO1824654197(value);
    }
    
    private com.google.gwt.json.client.JSONValue encodeReservationDTO1824654197( org.silverpeas.mobile.shared.dto.reservations.ReservationDTO value) {
      com.google.gwt.json.client.JSONObject rc = new com.google.gwt.json.client.JSONObject();
      org.silverpeas.mobile.shared.dto.reservations.ReservationDTO parseValue = (org.silverpeas.mobile.shared.dto.reservations.ReservationDTO)value;
      isNotNullValuePut(STRING.encode(parseValue.getId()), rc, "id");
      isNotNullValuePut(STRING.encode(parseValue.getEvenement()), rc, "evenement");
      isNotNullValuePut(STRING.encode(parseValue.getStartDate()), rc, "startDate");
      isNotNullValuePut(STRING.encode(parseValue.getEndDate()), rc, "endDate");
      isNotNullValuePut(STRING.encode(parseValue.getReason()), rc, "reason");
      isNotNullValuePut(STRING.encode(parseValue.getStatus()), rc, "status");
      isNotNullValuePut(toJSON(parseValue.getResources(), org.silverpeas.mobile.shared.dto.reservations.ResourceDTO_Generated_JsonEncoderDecoder_.INSTANCE), rc, "resources");
      return rc;
    }
    
    public org.silverpeas.mobile.shared.dto.reservations.ReservationDTO 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 decodeReservationDTO1824654197(object);
      }
      
      private org.silverpeas.mobile.shared.dto.reservations.ReservationDTO decodeReservationDTO1824654197(com.google.gwt.json.client.JSONObject object) {
        org.silverpeas.mobile.shared.dto.reservations.ReservationDTO rc = new org.silverpeas.mobile.shared.dto.reservations.ReservationDTO();
        rc.setId(getValueToSet(STRING.decode(object.get("id")), null));
        rc.setEvenement(getValueToSet(STRING.decode(object.get("evenement")), null));
        rc.setStartDate(getValueToSet(STRING.decode(object.get("startDate")), null));
        rc.setEndDate(getValueToSet(STRING.decode(object.get("endDate")), null));
        rc.setReason(getValueToSet(STRING.decode(object.get("reason")), null));
        rc.setStatus(getValueToSet(STRING.decode(object.get("status")), null));
        rc.setResources(getValueToSet(toList(object.get("resources"), org.silverpeas.mobile.shared.dto.reservations.ResourceDTO_Generated_JsonEncoderDecoder_.INSTANCE), null));
        return rc;
      }
      
    }
