// GENERATED SOURCE. DO NOT EDIT.
package com.google.collide.dto.server;

import com.google.collide.dtogen.server.JsonSerializable;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;

import java.util.Map;


@SuppressWarnings({"cast", "unchecked", "rawtypes"})
public class DtoServerImpls {

  private static final Gson gson = new GsonBuilder().serializeNulls().create();

  private  DtoServerImpls() {}

  public static final String CLIENT_SERVER_PROTOCOL_HASH = "18d5484025fe6d9b7a998e2c0d8088aa544eff10";

  public static class AddMembersResponseImpl extends com.google.collide.dtogen.server.RoutableDtoServerImpl implements com.google.collide.dto.AddMembersResponse, JsonSerializable {

    private AddMembersResponseImpl() {
      super(1);
    }

    protected AddMembersResponseImpl(int type) {
      super(type);
    }

    public static AddMembersResponseImpl make() {
      return new AddMembersResponseImpl();
    }

    protected java.util.List<UserDetailsWithRoleImpl> newMembers;
    private boolean _hasNewMembers;
    protected java.util.List<java.lang.String> invalidEmails;
    private boolean _hasInvalidEmails;

    public boolean hasNewMembers() {
      return _hasNewMembers;
    }

    @Override
    public com.google.collide.json.shared.JsonArray<com.google.collide.dto.UserDetailsWithRole> getNewMembers() {
      ensureNewMembers();
      return (com.google.collide.json.shared.JsonArray) new com.google.collide.json.server.JsonArrayListAdapter(newMembers);
    }

    public AddMembersResponseImpl setNewMembers(java.util.List<UserDetailsWithRoleImpl> v) {
      _hasNewMembers = true;
      newMembers = v;
      return this;
    }

    public void addNewMembers(UserDetailsWithRoleImpl v) {
      ensureNewMembers();
      newMembers.add(v);
    }

    public void clearNewMembers() {
      ensureNewMembers();
      newMembers.clear();
    }

    void ensureNewMembers() {
      if (!_hasNewMembers) {
        setNewMembers(newMembers != null ? newMembers : new java.util.ArrayList<UserDetailsWithRoleImpl>());
      }
    }

    public boolean hasInvalidEmails() {
      return _hasInvalidEmails;
    }

    @Override
    public com.google.collide.json.shared.JsonArray<java.lang.String> getInvalidEmails() {
      ensureInvalidEmails();
      return (com.google.collide.json.shared.JsonArray) new com.google.collide.json.server.JsonArrayListAdapter(invalidEmails);
    }

    public AddMembersResponseImpl setInvalidEmails(java.util.List<java.lang.String> v) {
      _hasInvalidEmails = true;
      invalidEmails = v;
      return this;
    }

    public void addInvalidEmails(java.lang.String v) {
      ensureInvalidEmails();
      invalidEmails.add(v);
    }

    public void clearInvalidEmails() {
      ensureInvalidEmails();
      invalidEmails.clear();
    }

    void ensureInvalidEmails() {
      if (!_hasInvalidEmails) {
        setInvalidEmails(invalidEmails != null ? invalidEmails : new java.util.ArrayList<java.lang.String>());
      }
    }

    @Override
    public boolean equals(Object o) {
      if (!super.equals(o)) {
        return false;
      }
      if (!(o instanceof AddMembersResponseImpl)) {
        return false;
      }
      AddMembersResponseImpl other = (AddMembersResponseImpl) o;
      if (this._hasNewMembers != other._hasNewMembers) {
        return false;
      }
      if (this._hasNewMembers) {
        if (!this.newMembers.equals(other.newMembers)) {
          return false;
        }
      }
      if (this._hasInvalidEmails != other._hasInvalidEmails) {
        return false;
      }
      if (this._hasInvalidEmails) {
        if (!this.invalidEmails.equals(other.invalidEmails)) {
          return false;
        }
      }
      return true;
    }

    @Override
    public int hashCode() {
      int hash = super.hashCode();
      hash = hash * 31 + (_hasNewMembers ? newMembers.hashCode() : 0);
      hash = hash * 31 + (_hasInvalidEmails ? invalidEmails.hashCode() : 0);
      return hash;
    }

    @Override
    public JsonElement toJsonElement() {
      JsonObject result = new JsonObject();

      JsonArray newMembersOut = new JsonArray();
      ensureNewMembers();
      for (UserDetailsWithRoleImpl newMembers_ : newMembers) {
        JsonElement newMembersOut_ = newMembers_ == null ? JsonNull.INSTANCE : newMembers_.toJsonElement();
        newMembersOut.add(newMembersOut_);
      }
      result.add("newMembers", newMembersOut);

      JsonArray invalidEmailsOut = new JsonArray();
      ensureInvalidEmails();
      for (java.lang.String invalidEmails_ : invalidEmails) {
        JsonElement invalidEmailsOut_ = (invalidEmails_ == null) ? JsonNull.INSTANCE : new JsonPrimitive(invalidEmails_);
        invalidEmailsOut.add(invalidEmailsOut_);
      }
      result.add("invalidEmails", invalidEmailsOut);
      result.add("_type", new JsonPrimitive(getType()));
      return result;
    }

    @Override
    public String toJson() {
      return gson.toJson(toJsonElement());
    }

    @Override
    public String toString() {
      return toJson();
    }

    public static AddMembersResponseImpl fromJsonElement(JsonElement jsonElem) {
      if (jsonElem == null || jsonElem.isJsonNull()) {
        return null;
      }

      AddMembersResponseImpl dto = new AddMembersResponseImpl();
      JsonObject json = jsonElem.getAsJsonObject();

      if (json.has("newMembers")) {
        JsonElement newMembersIn = json.get("newMembers");
        java.util.ArrayList<UserDetailsWithRoleImpl> newMembersOut = null;
        if (newMembersIn != null && !newMembersIn.isJsonNull()) {
          newMembersOut = new java.util.ArrayList<UserDetailsWithRoleImpl>();
          java.util.Iterator<JsonElement> newMembersInIterator = newMembersIn.getAsJsonArray().iterator();
          while (newMembersInIterator.hasNext()) {
            JsonElement newMembersIn_ = newMembersInIterator.next();
            UserDetailsWithRoleImpl newMembersOut_ = UserDetailsWithRoleImpl.fromJsonElement(newMembersIn_);
            newMembersOut.add(newMembersOut_);
          }
        }
        dto.setNewMembers(newMembersOut);
      }

      if (json.has("invalidEmails")) {
        JsonElement invalidEmailsIn = json.get("invalidEmails");
        java.util.ArrayList<java.lang.String> invalidEmailsOut = null;
        if (invalidEmailsIn != null && !invalidEmailsIn.isJsonNull()) {
          invalidEmailsOut = new java.util.ArrayList<java.lang.String>();
          java.util.Iterator<JsonElement> invalidEmailsInIterator = invalidEmailsIn.getAsJsonArray().iterator();
          while (invalidEmailsInIterator.hasNext()) {
            JsonElement invalidEmailsIn_ = invalidEmailsInIterator.next();
            java.lang.String invalidEmailsOut_ = gson.fromJson(invalidEmailsIn_, java.lang.String.class);
            invalidEmailsOut.add(invalidEmailsOut_);
          }
        }
        dto.setInvalidEmails(invalidEmailsOut);
      }

      return dto;
    }
    public static AddMembersResponseImpl fromJsonString(String jsonString) {
      if (jsonString == null) {
        return null;
      }

      return fromJsonElement(new JsonParser().parse(jsonString));
    }
  }

  public static class MockAddMembersResponseImpl extends AddMembersResponseImpl {
    protected MockAddMembersResponseImpl() {}

    public static AddMembersResponseImpl make() {
      return new AddMembersResponseImpl();
    }

  }

  public static class AddProjectMembersImpl extends com.google.collide.dtogen.server.RoutableDtoServerImpl implements com.google.collide.dto.AddProjectMembers, JsonSerializable {

    private AddProjectMembersImpl() {
      super(2);
    }

    protected AddProjectMembersImpl(int type) {
      super(type);
    }

    protected ChangeRoleInfoImpl changeRoleInfo;
    private boolean _hasChangeRoleInfo;
    protected java.lang.String projectId;
    private boolean _hasProjectId;
    protected java.lang.String userEmails;
    private boolean _hasUserEmails;

    public boolean hasChangeRoleInfo() {
      return _hasChangeRoleInfo;
    }

    @Override
    public com.google.collide.dto.ChangeRoleInfo getChangeRoleInfo() {
      return changeRoleInfo;
    }

    public AddProjectMembersImpl setChangeRoleInfo(ChangeRoleInfoImpl v) {
      _hasChangeRoleInfo = true;
      changeRoleInfo = v;
      return this;
    }

    public boolean hasProjectId() {
      return _hasProjectId;
    }

    @Override
    public java.lang.String getProjectId() {
      return projectId;
    }

    public AddProjectMembersImpl setProjectId(java.lang.String v) {
      _hasProjectId = true;
      projectId = v;
      return this;
    }

    public boolean hasUserEmails() {
      return _hasUserEmails;
    }

    @Override
    public java.lang.String getUserEmails() {
      return userEmails;
    }

    public AddProjectMembersImpl setUserEmails(java.lang.String v) {
      _hasUserEmails = true;
      userEmails = v;
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (!super.equals(o)) {
        return false;
      }
      if (!(o instanceof AddProjectMembersImpl)) {
        return false;
      }
      AddProjectMembersImpl other = (AddProjectMembersImpl) o;
      if (this._hasChangeRoleInfo != other._hasChangeRoleInfo) {
        return false;
      }
      if (this._hasChangeRoleInfo) {
        if (!this.changeRoleInfo.equals(other.changeRoleInfo)) {
          return false;
        }
      }
      if (this._hasProjectId != other._hasProjectId) {
        return false;
      }
      if (this._hasProjectId) {
        if (!this.projectId.equals(other.projectId)) {
          return false;
        }
      }
      if (this._hasUserEmails != other._hasUserEmails) {
        return false;
      }
      if (this._hasUserEmails) {
        if (!this.userEmails.equals(other.userEmails)) {
          return false;
        }
      }
      return true;
    }

    @Override
    public int hashCode() {
      int hash = super.hashCode();
      hash = hash * 31 + (_hasChangeRoleInfo ? changeRoleInfo.hashCode() : 0);
      hash = hash * 31 + (_hasProjectId ? projectId.hashCode() : 0);
      hash = hash * 31 + (_hasUserEmails ? userEmails.hashCode() : 0);
      return hash;
    }

    @Override
    public JsonElement toJsonElement() {
      JsonObject result = new JsonObject();

      JsonElement changeRoleInfoOut = changeRoleInfo == null ? JsonNull.INSTANCE : changeRoleInfo.toJsonElement();
      result.add("changeRoleInfo", changeRoleInfoOut);

      JsonElement projectIdOut = (projectId == null) ? JsonNull.INSTANCE : new JsonPrimitive(projectId);
      result.add("projectId", projectIdOut);

      JsonElement userEmailsOut = (userEmails == null) ? JsonNull.INSTANCE : new JsonPrimitive(userEmails);
      result.add("userEmails", userEmailsOut);
      result.add("_type", new JsonPrimitive(getType()));
      return result;
    }

    @Override
    public String toJson() {
      return gson.toJson(toJsonElement());
    }

    @Override
    public String toString() {
      return toJson();
    }

    public static AddProjectMembersImpl fromJsonElement(JsonElement jsonElem) {
      if (jsonElem == null || jsonElem.isJsonNull()) {
        return null;
      }

      AddProjectMembersImpl dto = new AddProjectMembersImpl();
      JsonObject json = jsonElem.getAsJsonObject();

      if (json.has("changeRoleInfo")) {
        JsonElement changeRoleInfoIn = json.get("changeRoleInfo");
        ChangeRoleInfoImpl changeRoleInfoOut = ChangeRoleInfoImpl.fromJsonElement(changeRoleInfoIn);
        dto.setChangeRoleInfo(changeRoleInfoOut);
      }

      if (json.has("projectId")) {
        JsonElement projectIdIn = json.get("projectId");
        java.lang.String projectIdOut = gson.fromJson(projectIdIn, java.lang.String.class);
        dto.setProjectId(projectIdOut);
      }

      if (json.has("userEmails")) {
        JsonElement userEmailsIn = json.get("userEmails");
        java.lang.String userEmailsOut = gson.fromJson(userEmailsIn, java.lang.String.class);
        dto.setUserEmails(userEmailsOut);
      }

      return dto;
    }
    public static AddProjectMembersImpl fromJsonString(String jsonString) {
      if (jsonString == null) {
        return null;
      }

      return fromJsonElement(new JsonParser().parse(jsonString));
    }
  }

  public static class MockAddProjectMembersImpl extends AddProjectMembersImpl {
    protected MockAddProjectMembersImpl() {}

    public static AddProjectMembersImpl make() {
      return new AddProjectMembersImpl();
    }

  }

  public static class AddWorkspaceMembersImpl extends com.google.collide.dtogen.server.RoutableDtoServerImpl implements com.google.collide.dto.AddWorkspaceMembers, JsonSerializable {

    private AddWorkspaceMembersImpl() {
      super(3);
    }

    protected AddWorkspaceMembersImpl(int type) {
      super(type);
    }

    protected java.lang.String workspaceId;
    private boolean _hasWorkspaceId;
    protected ChangeRoleInfoImpl changeRoleInfo;
    private boolean _hasChangeRoleInfo;
    protected java.lang.String projectId;
    private boolean _hasProjectId;
    protected java.lang.String userEmails;
    private boolean _hasUserEmails;

    public boolean hasWorkspaceId() {
      return _hasWorkspaceId;
    }

    @Override
    public java.lang.String getWorkspaceId() {
      return workspaceId;
    }

    public AddWorkspaceMembersImpl setWorkspaceId(java.lang.String v) {
      _hasWorkspaceId = true;
      workspaceId = v;
      return this;
    }

    public boolean hasChangeRoleInfo() {
      return _hasChangeRoleInfo;
    }

    @Override
    public com.google.collide.dto.ChangeRoleInfo getChangeRoleInfo() {
      return changeRoleInfo;
    }

    public AddWorkspaceMembersImpl setChangeRoleInfo(ChangeRoleInfoImpl v) {
      _hasChangeRoleInfo = true;
      changeRoleInfo = v;
      return this;
    }

    public boolean hasProjectId() {
      return _hasProjectId;
    }

    @Override
    public java.lang.String getProjectId() {
      return projectId;
    }

    public AddWorkspaceMembersImpl setProjectId(java.lang.String v) {
      _hasProjectId = true;
      projectId = v;
      return this;
    }

    public boolean hasUserEmails() {
      return _hasUserEmails;
    }

    @Override
    public java.lang.String getUserEmails() {
      return userEmails;
    }

    public AddWorkspaceMembersImpl setUserEmails(java.lang.String v) {
      _hasUserEmails = true;
      userEmails = v;
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (!super.equals(o)) {
        return false;
      }
      if (!(o instanceof AddWorkspaceMembersImpl)) {
        return false;
      }
      AddWorkspaceMembersImpl other = (AddWorkspaceMembersImpl) o;
      if (this._hasWorkspaceId != other._hasWorkspaceId) {
        return false;
      }
      if (this._hasWorkspaceId) {
        if (!this.workspaceId.equals(other.workspaceId)) {
          return false;
        }
      }
      if (this._hasChangeRoleInfo != other._hasChangeRoleInfo) {
        return false;
      }
      if (this._hasChangeRoleInfo) {
        if (!this.changeRoleInfo.equals(other.changeRoleInfo)) {
          return false;
        }
      }
      if (this._hasProjectId != other._hasProjectId) {
        return false;
      }
      if (this._hasProjectId) {
        if (!this.projectId.equals(other.projectId)) {
          return false;
        }
      }
      if (this._hasUserEmails != other._hasUserEmails) {
        return false;
      }
      if (this._hasUserEmails) {
        if (!this.userEmails.equals(other.userEmails)) {
          return false;
        }
      }
      return true;
    }

    @Override
    public int hashCode() {
      int hash = super.hashCode();
      hash = hash * 31 + (_hasWorkspaceId ? workspaceId.hashCode() : 0);
      hash = hash * 31 + (_hasChangeRoleInfo ? changeRoleInfo.hashCode() : 0);
      hash = hash * 31 + (_hasProjectId ? projectId.hashCode() : 0);
      hash = hash * 31 + (_hasUserEmails ? userEmails.hashCode() : 0);
      return hash;
    }

    @Override
    public JsonElement toJsonElement() {
      JsonObject result = new JsonObject();

      JsonElement workspaceIdOut = (workspaceId == null) ? JsonNull.INSTANCE : new JsonPrimitive(workspaceId);
      result.add("workspaceId", workspaceIdOut);

      JsonElement changeRoleInfoOut = changeRoleInfo == null ? JsonNull.INSTANCE : changeRoleInfo.toJsonElement();
      result.add("changeRoleInfo", changeRoleInfoOut);

      JsonElement projectIdOut = (projectId == null) ? JsonNull.INSTANCE : new JsonPrimitive(projectId);
      result.add("projectId", projectIdOut);

      JsonElement userEmailsOut = (userEmails == null) ? JsonNull.INSTANCE : new JsonPrimitive(userEmails);
      result.add("userEmails", userEmailsOut);
      result.add("_type", new JsonPrimitive(getType()));
      return result;
    }

    @Override
    public String toJson() {
      return gson.toJson(toJsonElement());
    }

    @Override
    public String toString() {
      return toJson();
    }

    public static AddWorkspaceMembersImpl fromJsonElement(JsonElement jsonElem) {
      if (jsonElem == null || jsonElem.isJsonNull()) {
        return null;
      }

      AddWorkspaceMembersImpl dto = new AddWorkspaceMembersImpl();
      JsonObject json = jsonElem.getAsJsonObject();

      if (json.has("workspaceId")) {
        JsonElement workspaceIdIn = json.get("workspaceId");
        java.lang.String workspaceIdOut = gson.fromJson(workspaceIdIn, java.lang.String.class);
        dto.setWorkspaceId(workspaceIdOut);
      }

      if (json.has("changeRoleInfo")) {
        JsonElement changeRoleInfoIn = json.get("changeRoleInfo");
        ChangeRoleInfoImpl changeRoleInfoOut = ChangeRoleInfoImpl.fromJsonElement(changeRoleInfoIn);
        dto.setChangeRoleInfo(changeRoleInfoOut);
      }

      if (json.has("projectId")) {
        JsonElement projectIdIn = json.get("projectId");
        java.lang.String projectIdOut = gson.fromJson(projectIdIn, java.lang.String.class);
        dto.setProjectId(projectIdOut);
      }

      if (json.has("userEmails")) {
        JsonElement userEmailsIn = json.get("userEmails");
        java.lang.String userEmailsOut = gson.fromJson(userEmailsIn, java.lang.String.class);
        dto.setUserEmails(userEmailsOut);
      }

      return dto;
    }
    public static AddWorkspaceMembersImpl fromJsonString(String jsonString) {
      if (jsonString == null) {
        return null;
      }

      return fromJsonElement(new JsonParser().parse(jsonString));
    }
  }

  public static class MockAddWorkspaceMembersImpl extends AddWorkspaceMembersImpl {
    protected MockAddWorkspaceMembersImpl() {}

    public static AddWorkspaceMembersImpl make() {
      return new AddWorkspaceMembersImpl();
    }

  }

  public static class BeginUploadSessionImpl extends com.google.collide.dtogen.server.RoutableDtoServerImpl implements com.google.collide.dto.BeginUploadSession, JsonSerializable {

    private BeginUploadSessionImpl() {
      super(4);
    }

    protected BeginUploadSessionImpl(int type) {
      super(type);
    }

    protected java.util.List<java.lang.String> workspacePathsToReplace;
    private boolean _hasWorkspacePathsToReplace;
    protected java.util.List<java.lang.String> workspacePathsToUnzip;
    private boolean _hasWorkspacePathsToUnzip;
    protected java.util.List<java.lang.String> workspaceDirsToCreate;
    private boolean _hasWorkspaceDirsToCreate;
    protected java.lang.String clientId;
    private boolean _hasClientId;
    protected java.lang.String workspaceId;
    private boolean _hasWorkspaceId;
    protected java.lang.String sessionId;
    private boolean _hasSessionId;

    public boolean hasWorkspacePathsToReplace() {
      return _hasWorkspacePathsToReplace;
    }

    @Override
    public com.google.collide.json.shared.JsonArray<java.lang.String> getWorkspacePathsToReplace() {
      ensureWorkspacePathsToReplace();
      return (com.google.collide.json.shared.JsonArray) new com.google.collide.json.server.JsonArrayListAdapter(workspacePathsToReplace);
    }

    public BeginUploadSessionImpl setWorkspacePathsToReplace(java.util.List<java.lang.String> v) {
      _hasWorkspacePathsToReplace = true;
      workspacePathsToReplace = v;
      return this;
    }

    public void addWorkspacePathsToReplace(java.lang.String v) {
      ensureWorkspacePathsToReplace();
      workspacePathsToReplace.add(v);
    }

    public void clearWorkspacePathsToReplace() {
      ensureWorkspacePathsToReplace();
      workspacePathsToReplace.clear();
    }

    void ensureWorkspacePathsToReplace() {
      if (!_hasWorkspacePathsToReplace) {
        setWorkspacePathsToReplace(workspacePathsToReplace != null ? workspacePathsToReplace : new java.util.ArrayList<java.lang.String>());
      }
    }

    public boolean hasWorkspacePathsToUnzip() {
      return _hasWorkspacePathsToUnzip;
    }

    @Override
    public com.google.collide.json.shared.JsonArray<java.lang.String> getWorkspacePathsToUnzip() {
      ensureWorkspacePathsToUnzip();
      return (com.google.collide.json.shared.JsonArray) new com.google.collide.json.server.JsonArrayListAdapter(workspacePathsToUnzip);
    }

    public BeginUploadSessionImpl setWorkspacePathsToUnzip(java.util.List<java.lang.String> v) {
      _hasWorkspacePathsToUnzip = true;
      workspacePathsToUnzip = v;
      return this;
    }

    public void addWorkspacePathsToUnzip(java.lang.String v) {
      ensureWorkspacePathsToUnzip();
      workspacePathsToUnzip.add(v);
    }

    public void clearWorkspacePathsToUnzip() {
      ensureWorkspacePathsToUnzip();
      workspacePathsToUnzip.clear();
    }

    void ensureWorkspacePathsToUnzip() {
      if (!_hasWorkspacePathsToUnzip) {
        setWorkspacePathsToUnzip(workspacePathsToUnzip != null ? workspacePathsToUnzip : new java.util.ArrayList<java.lang.String>());
      }
    }

    public boolean hasWorkspaceDirsToCreate() {
      return _hasWorkspaceDirsToCreate;
    }

    @Override
    public com.google.collide.json.shared.JsonArray<java.lang.String> getWorkspaceDirsToCreate() {
      ensureWorkspaceDirsToCreate();
      return (com.google.collide.json.shared.JsonArray) new com.google.collide.json.server.JsonArrayListAdapter(workspaceDirsToCreate);
    }

    public BeginUploadSessionImpl setWorkspaceDirsToCreate(java.util.List<java.lang.String> v) {
      _hasWorkspaceDirsToCreate = true;
      workspaceDirsToCreate = v;
      return this;
    }

    public void addWorkspaceDirsToCreate(java.lang.String v) {
      ensureWorkspaceDirsToCreate();
      workspaceDirsToCreate.add(v);
    }

    public void clearWorkspaceDirsToCreate() {
      ensureWorkspaceDirsToCreate();
      workspaceDirsToCreate.clear();
    }

    void ensureWorkspaceDirsToCreate() {
      if (!_hasWorkspaceDirsToCreate) {
        setWorkspaceDirsToCreate(workspaceDirsToCreate != null ? workspaceDirsToCreate : new java.util.ArrayList<java.lang.String>());
      }
    }

    public boolean hasClientId() {
      return _hasClientId;
    }

    @Override
    public java.lang.String getClientId() {
      return clientId;
    }

    public BeginUploadSessionImpl setClientId(java.lang.String v) {
      _hasClientId = true;
      clientId = v;
      return this;
    }

    public boolean hasWorkspaceId() {
      return _hasWorkspaceId;
    }

    @Override
    public java.lang.String getWorkspaceId() {
      return workspaceId;
    }

    public BeginUploadSessionImpl setWorkspaceId(java.lang.String v) {
      _hasWorkspaceId = true;
      workspaceId = v;
      return this;
    }

    public boolean hasSessionId() {
      return _hasSessionId;
    }

    @Override
    public java.lang.String getSessionId() {
      return sessionId;
    }

    public BeginUploadSessionImpl setSessionId(java.lang.String v) {
      _hasSessionId = true;
      sessionId = v;
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (!super.equals(o)) {
        return false;
      }
      if (!(o instanceof BeginUploadSessionImpl)) {
        return false;
      }
      BeginUploadSessionImpl other = (BeginUploadSessionImpl) o;
      if (this._hasWorkspacePathsToReplace != other._hasWorkspacePathsToReplace) {
        return false;
      }
      if (this._hasWorkspacePathsToReplace) {
        if (!this.workspacePathsToReplace.equals(other.workspacePathsToReplace)) {
          return false;
        }
      }
      if (this._hasWorkspacePathsToUnzip != other._hasWorkspacePathsToUnzip) {
        return false;
      }
      if (this._hasWorkspacePathsToUnzip) {
        if (!this.workspacePathsToUnzip.equals(other.workspacePathsToUnzip)) {
          return false;
        }
      }
      if (this._hasWorkspaceDirsToCreate != other._hasWorkspaceDirsToCreate) {
        return false;
      }
      if (this._hasWorkspaceDirsToCreate) {
        if (!this.workspaceDirsToCreate.equals(other.workspaceDirsToCreate)) {
          return false;
        }
      }
      if (this._hasClientId != other._hasClientId) {
        return false;
      }
      if (this._hasClientId) {
        if (!this.clientId.equals(other.clientId)) {
          return false;
        }
      }
      if (this._hasWorkspaceId != other._hasWorkspaceId) {
        return false;
      }
      if (this._hasWorkspaceId) {
        if (!this.workspaceId.equals(other.workspaceId)) {
          return false;
        }
      }
      if (this._hasSessionId != other._hasSessionId) {
        return false;
      }
      if (this._hasSessionId) {
        if (!this.sessionId.equals(other.sessionId)) {
          return false;
        }
      }
      return true;
    }

    @Override
    public int hashCode() {
      int hash = super.hashCode();
      hash = hash * 31 + (_hasWorkspacePathsToReplace ? workspacePathsToReplace.hashCode() : 0);
      hash = hash * 31 + (_hasWorkspacePathsToUnzip ? workspacePathsToUnzip.hashCode() : 0);
      hash = hash * 31 + (_hasWorkspaceDirsToCreate ? workspaceDirsToCreate.hashCode() : 0);
      hash = hash * 31 + (_hasClientId ? clientId.hashCode() : 0);
      hash = hash * 31 + (_hasWorkspaceId ? workspaceId.hashCode() : 0);
      hash = hash * 31 + (_hasSessionId ? sessionId.hashCode() : 0);
      return hash;
    }

    @Override
    public JsonElement toJsonElement() {
      JsonObject result = new JsonObject();

      JsonArray workspacePathsToReplaceOut = new JsonArray();
      ensureWorkspacePathsToReplace();
      for (java.lang.String workspacePathsToReplace_ : workspacePathsToReplace) {
        JsonElement workspacePathsToReplaceOut_ = (workspacePathsToReplace_ == null) ? JsonNull.INSTANCE : new JsonPrimitive(workspacePathsToReplace_);
        workspacePathsToReplaceOut.add(workspacePathsToReplaceOut_);
      }
      result.add("workspacePathsToReplace", workspacePathsToReplaceOut);

      JsonArray workspacePathsToUnzipOut = new JsonArray();
      ensureWorkspacePathsToUnzip();
      for (java.lang.String workspacePathsToUnzip_ : workspacePathsToUnzip) {
        JsonElement workspacePathsToUnzipOut_ = (workspacePathsToUnzip_ == null) ? JsonNull.INSTANCE : new JsonPrimitive(workspacePathsToUnzip_);
        workspacePathsToUnzipOut.add(workspacePathsToUnzipOut_);
      }
      result.add("workspacePathsToUnzip", workspacePathsToUnzipOut);

      JsonArray workspaceDirsToCreateOut = new JsonArray();
      ensureWorkspaceDirsToCreate();
      for (java.lang.String workspaceDirsToCreate_ : workspaceDirsToCreate) {
        JsonElement workspaceDirsToCreateOut_ = (workspaceDirsToCreate_ == null) ? JsonNull.INSTANCE : new JsonPrimitive(workspaceDirsToCreate_);
        workspaceDirsToCreateOut.add(workspaceDirsToCreateOut_);
      }
      result.add("workspaceDirsToCreate", workspaceDirsToCreateOut);

      JsonElement clientIdOut = (clientId == null) ? JsonNull.INSTANCE : new JsonPrimitive(clientId);
      result.add("clientId", clientIdOut);

      JsonElement workspaceIdOut = (workspaceId == null) ? JsonNull.INSTANCE : new JsonPrimitive(workspaceId);
      result.add("workspaceId", workspaceIdOut);

      JsonElement sessionIdOut = (sessionId == null) ? JsonNull.INSTANCE : new JsonPrimitive(sessionId);
      result.add("sessionId", sessionIdOut);
      result.add("_type", new JsonPrimitive(getType()));
      return result;
    }

    @Override
    public String toJson() {
      return gson.toJson(toJsonElement());
    }

    @Override
    public String toString() {
      return toJson();
    }

    public static BeginUploadSessionImpl fromJsonElement(JsonElement jsonElem) {
      if (jsonElem == null || jsonElem.isJsonNull()) {
        return null;
      }

      BeginUploadSessionImpl dto = new BeginUploadSessionImpl();
      JsonObject json = jsonElem.getAsJsonObject();

      if (json.has("workspacePathsToReplace")) {
        JsonElement workspacePathsToReplaceIn = json.get("workspacePathsToReplace");
        java.util.ArrayList<java.lang.String> workspacePathsToReplaceOut = null;
        if (workspacePathsToReplaceIn != null && !workspacePathsToReplaceIn.isJsonNull()) {
          workspacePathsToReplaceOut = new java.util.ArrayList<java.lang.String>();
          java.util.Iterator<JsonElement> workspacePathsToReplaceInIterator = workspacePathsToReplaceIn.getAsJsonArray().iterator();
          while (workspacePathsToReplaceInIterator.hasNext()) {
            JsonElement workspacePathsToReplaceIn_ = workspacePathsToReplaceInIterator.next();
            java.lang.String workspacePathsToReplaceOut_ = gson.fromJson(workspacePathsToReplaceIn_, java.lang.String.class);
            workspacePathsToReplaceOut.add(workspacePathsToReplaceOut_);
          }
        }
        dto.setWorkspacePathsToReplace(workspacePathsToReplaceOut);
      }

      if (json.has("workspacePathsToUnzip")) {
        JsonElement workspacePathsToUnzipIn = json.get("workspacePathsToUnzip");
        java.util.ArrayList<java.lang.String> workspacePathsToUnzipOut = null;
        if (workspacePathsToUnzipIn != null && !workspacePathsToUnzipIn.isJsonNull()) {
          workspacePathsToUnzipOut = new java.util.ArrayList<java.lang.String>();
          java.util.Iterator<JsonElement> workspacePathsToUnzipInIterator = workspacePathsToUnzipIn.getAsJsonArray().iterator();
          while (workspacePathsToUnzipInIterator.hasNext()) {
            JsonElement workspacePathsToUnzipIn_ = workspacePathsToUnzipInIterator.next();
            java.lang.String workspacePathsToUnzipOut_ = gson.fromJson(workspacePathsToUnzipIn_, java.lang.String.class);
            workspacePathsToUnzipOut.add(workspacePathsToUnzipOut_);
          }
        }
        dto.setWorkspacePathsToUnzip(workspacePathsToUnzipOut);
      }

      if (json.has("workspaceDirsToCreate")) {
        JsonElement workspaceDirsToCreateIn = json.get("workspaceDirsToCreate");
        java.util.ArrayList<java.lang.String> workspaceDirsToCreateOut = null;
        if (workspaceDirsToCreateIn != null && !workspaceDirsToCreateIn.isJsonNull()) {
          workspaceDirsToCreateOut = new java.util.ArrayList<java.lang.String>();
          java.util.Iterator<JsonElement> workspaceDirsToCreateInIterator = workspaceDirsToCreateIn.getAsJsonArray().iterator();
          while (workspaceDirsToCreateInIterator.hasNext()) {
            JsonElement workspaceDirsToCreateIn_ = workspaceDirsToCreateInIterator.next();
            java.lang.String workspaceDirsToCreateOut_ = gson.fromJson(workspaceDirsToCreateIn_, java.lang.String.class);
            workspaceDirsToCreateOut.add(workspaceDirsToCreateOut_);
          }
        }
        dto.setWorkspaceDirsToCreate(workspaceDirsToCreateOut);
      }

      if (json.has("clientId")) {
        JsonElement clientIdIn = json.get("clientId");
        java.lang.String clientIdOut = gson.fromJson(clientIdIn, java.lang.String.class);
        dto.setClientId(clientIdOut);
      }

      if (json.has("workspaceId")) {
        JsonElement workspaceIdIn = json.get("workspaceId");
        java.lang.String workspaceIdOut = gson.fromJson(workspaceIdIn, java.lang.String.class);
        dto.setWorkspaceId(workspaceIdOut);
      }

      if (json.has("sessionId")) {
        JsonElement sessionIdIn = json.get("sessionId");
        java.lang.String sessionIdOut = gson.fromJson(sessionIdIn, java.lang.String.class);
        dto.setSessionId(sessionIdOut);
      }

      return dto;
    }
    public static BeginUploadSessionImpl fromJsonString(String jsonString) {
      if (jsonString == null) {
        return null;
      }

