001package com.box.sdkgen.managers.workflows; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.schemas.outcome.Outcome; 006import com.box.sdkgen.serialization.json.EnumWrapper; 007import com.fasterxml.jackson.annotation.JsonFilter; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 010import com.fasterxml.jackson.databind.annotation.JsonSerialize; 011import java.util.List; 012import java.util.Objects; 013 014@JsonFilter("nullablePropertyFilter") 015public class StartWorkflowRequestBody extends SerializableObject { 016 017 /** The type of the parameters object. */ 018 @JsonDeserialize( 019 using = StartWorkflowRequestBodyTypeField.StartWorkflowRequestBodyTypeFieldDeserializer.class) 020 @JsonSerialize( 021 using = StartWorkflowRequestBodyTypeField.StartWorkflowRequestBodyTypeFieldSerializer.class) 022 protected EnumWrapper<StartWorkflowRequestBodyTypeField> type; 023 024 /** The flow that will be triggered. */ 025 protected final StartWorkflowRequestBodyFlowField flow; 026 027 /** 028 * The array of files for which the workflow should start. All files must be in the workflow's 029 * configured folder. 030 */ 031 protected final List<StartWorkflowRequestBodyFilesField> files; 032 033 /** The folder object for which the workflow is configured. */ 034 protected final StartWorkflowRequestBodyFolderField folder; 035 036 /** A configurable outcome the workflow should complete. */ 037 protected List<Outcome> outcomes; 038 039 public StartWorkflowRequestBody( 040 @JsonProperty("flow") StartWorkflowRequestBodyFlowField flow, 041 @JsonProperty("files") List<StartWorkflowRequestBodyFilesField> files, 042 @JsonProperty("folder") StartWorkflowRequestBodyFolderField folder) { 043 super(); 044 this.flow = flow; 045 this.files = files; 046 this.folder = folder; 047 } 048 049 protected StartWorkflowRequestBody(Builder builder) { 050 super(); 051 this.type = builder.type; 052 this.flow = builder.flow; 053 this.files = builder.files; 054 this.folder = builder.folder; 055 this.outcomes = builder.outcomes; 056 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 057 } 058 059 public EnumWrapper<StartWorkflowRequestBodyTypeField> getType() { 060 return type; 061 } 062 063 public StartWorkflowRequestBodyFlowField getFlow() { 064 return flow; 065 } 066 067 public List<StartWorkflowRequestBodyFilesField> getFiles() { 068 return files; 069 } 070 071 public StartWorkflowRequestBodyFolderField getFolder() { 072 return folder; 073 } 074 075 public List<Outcome> getOutcomes() { 076 return outcomes; 077 } 078 079 @Override 080 public boolean equals(Object o) { 081 if (this == o) { 082 return true; 083 } 084 if (o == null || getClass() != o.getClass()) { 085 return false; 086 } 087 StartWorkflowRequestBody casted = (StartWorkflowRequestBody) o; 088 return Objects.equals(type, casted.type) 089 && Objects.equals(flow, casted.flow) 090 && Objects.equals(files, casted.files) 091 && Objects.equals(folder, casted.folder) 092 && Objects.equals(outcomes, casted.outcomes); 093 } 094 095 @Override 096 public int hashCode() { 097 return Objects.hash(type, flow, files, folder, outcomes); 098 } 099 100 @Override 101 public String toString() { 102 return "StartWorkflowRequestBody{" 103 + "type='" 104 + type 105 + '\'' 106 + ", " 107 + "flow='" 108 + flow 109 + '\'' 110 + ", " 111 + "files='" 112 + files 113 + '\'' 114 + ", " 115 + "folder='" 116 + folder 117 + '\'' 118 + ", " 119 + "outcomes='" 120 + outcomes 121 + '\'' 122 + "}"; 123 } 124 125 public static class Builder extends NullableFieldTracker { 126 127 protected EnumWrapper<StartWorkflowRequestBodyTypeField> type; 128 129 protected final StartWorkflowRequestBodyFlowField flow; 130 131 protected final List<StartWorkflowRequestBodyFilesField> files; 132 133 protected final StartWorkflowRequestBodyFolderField folder; 134 135 protected List<Outcome> outcomes; 136 137 public Builder( 138 StartWorkflowRequestBodyFlowField flow, 139 List<StartWorkflowRequestBodyFilesField> files, 140 StartWorkflowRequestBodyFolderField folder) { 141 super(); 142 this.flow = flow; 143 this.files = files; 144 this.folder = folder; 145 } 146 147 public Builder type(StartWorkflowRequestBodyTypeField type) { 148 this.type = new EnumWrapper<StartWorkflowRequestBodyTypeField>(type); 149 return this; 150 } 151 152 public Builder type(EnumWrapper<StartWorkflowRequestBodyTypeField> type) { 153 this.type = type; 154 return this; 155 } 156 157 public Builder outcomes(List<Outcome> outcomes) { 158 this.outcomes = outcomes; 159 return this; 160 } 161 162 public StartWorkflowRequestBody build() { 163 return new StartWorkflowRequestBody(this); 164 } 165 } 166}