001package com.box.sdkgen.schemas.v2026r0.automateworkflowactionv2026r0;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.internal.utils.DateTimeUtils;
006import com.box.sdkgen.schemas.v2026r0.automateworkflowreferencev2026r0.AutomateWorkflowReferenceV2026R0;
007import com.box.sdkgen.schemas.v2026r0.userminiv2026r0.UserMiniV2026R0;
008import com.box.sdkgen.serialization.json.EnumWrapper;
009import com.fasterxml.jackson.annotation.JsonFilter;
010import com.fasterxml.jackson.annotation.JsonProperty;
011import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
012import com.fasterxml.jackson.databind.annotation.JsonSerialize;
013import java.time.OffsetDateTime;
014import java.util.Objects;
015
016/** An Automate action that can start a workflow. */
017@JsonFilter("nullablePropertyFilter")
018public class AutomateWorkflowActionV2026R0 extends SerializableObject {
019
020  /** The identifier for the Automate action. */
021  protected final String id;
022
023  /** The object type for this workflow action wrapper. */
024  @JsonDeserialize(
025      using =
026          AutomateWorkflowActionV2026R0TypeField.AutomateWorkflowActionV2026R0TypeFieldDeserializer
027              .class)
028  @JsonSerialize(
029      using =
030          AutomateWorkflowActionV2026R0TypeField.AutomateWorkflowActionV2026R0TypeFieldSerializer
031              .class)
032  protected EnumWrapper<AutomateWorkflowActionV2026R0TypeField> type;
033
034  /** The type that defines the behavior of this action. */
035  @JsonDeserialize(
036      using =
037          AutomateWorkflowActionV2026R0ActionTypeField
038              .AutomateWorkflowActionV2026R0ActionTypeFieldDeserializer.class)
039  @JsonSerialize(
040      using =
041          AutomateWorkflowActionV2026R0ActionTypeField
042              .AutomateWorkflowActionV2026R0ActionTypeFieldSerializer.class)
043  @JsonProperty("action_type")
044  protected EnumWrapper<AutomateWorkflowActionV2026R0ActionTypeField> actionType;
045
046  /** A human-readable description of the workflow action. */
047  protected String description;
048
049  /** The date and time when the action was created. */
050  @JsonProperty("created_at")
051  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
052  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
053  protected OffsetDateTime createdAt;
054
055  /** The date and time when the action was last updated. */
056  @JsonProperty("updated_at")
057  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
058  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
059  protected OffsetDateTime updatedAt;
060
061  @JsonProperty("created_by")
062  protected UserMiniV2026R0 createdBy;
063
064  @JsonProperty("updated_by")
065  protected UserMiniV2026R0 updatedBy;
066
067  protected final AutomateWorkflowReferenceV2026R0 workflow;
068
069  public AutomateWorkflowActionV2026R0(
070      @JsonProperty("id") String id,
071      @JsonProperty("workflow") AutomateWorkflowReferenceV2026R0 workflow) {
072    super();
073    this.id = id;
074    this.workflow = workflow;
075    this.type =
076        new EnumWrapper<AutomateWorkflowActionV2026R0TypeField>(
077            AutomateWorkflowActionV2026R0TypeField.WORKFLOW_ACTION);
078    this.actionType =
079        new EnumWrapper<AutomateWorkflowActionV2026R0ActionTypeField>(
080            AutomateWorkflowActionV2026R0ActionTypeField.RUN_WORKFLOW);
081  }
082
083  protected AutomateWorkflowActionV2026R0(Builder builder) {
084    super();
085    this.id = builder.id;
086    this.type = builder.type;
087    this.actionType = builder.actionType;
088    this.description = builder.description;
089    this.createdAt = builder.createdAt;
090    this.updatedAt = builder.updatedAt;
091    this.createdBy = builder.createdBy;
092    this.updatedBy = builder.updatedBy;
093    this.workflow = builder.workflow;
094    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
095  }
096
097  public String getId() {
098    return id;
099  }
100
101  public EnumWrapper<AutomateWorkflowActionV2026R0TypeField> getType() {
102    return type;
103  }
104
105  public EnumWrapper<AutomateWorkflowActionV2026R0ActionTypeField> getActionType() {
106    return actionType;
107  }
108
109  public String getDescription() {
110    return description;
111  }
112
113  public OffsetDateTime getCreatedAt() {
114    return createdAt;
115  }
116
117  public OffsetDateTime getUpdatedAt() {
118    return updatedAt;
119  }
120
121  public UserMiniV2026R0 getCreatedBy() {
122    return createdBy;
123  }
124
125  public UserMiniV2026R0 getUpdatedBy() {
126    return updatedBy;
127  }
128
129  public AutomateWorkflowReferenceV2026R0 getWorkflow() {
130    return workflow;
131  }
132
133  @Override
134  public boolean equals(Object o) {
135    if (this == o) {
136      return true;
137    }
138    if (o == null || getClass() != o.getClass()) {
139      return false;
140    }
141    AutomateWorkflowActionV2026R0 casted = (AutomateWorkflowActionV2026R0) o;
142    return Objects.equals(id, casted.id)
143        && Objects.equals(type, casted.type)
144        && Objects.equals(actionType, casted.actionType)
145        && Objects.equals(description, casted.description)
146        && Objects.equals(createdAt, casted.createdAt)
147        && Objects.equals(updatedAt, casted.updatedAt)
148        && Objects.equals(createdBy, casted.createdBy)
149        && Objects.equals(updatedBy, casted.updatedBy)
150        && Objects.equals(workflow, casted.workflow);
151  }
152
153  @Override
154  public int hashCode() {
155    return Objects.hash(
156        id, type, actionType, description, createdAt, updatedAt, createdBy, updatedBy, workflow);
157  }
158
159  @Override
160  public String toString() {
161    return "AutomateWorkflowActionV2026R0{"
162        + "id='"
163        + id
164        + '\''
165        + ", "
166        + "type='"
167        + type
168        + '\''
169        + ", "
170        + "actionType='"
171        + actionType
172        + '\''
173        + ", "
174        + "description='"
175        + description
176        + '\''
177        + ", "
178        + "createdAt='"
179        + createdAt
180        + '\''
181        + ", "
182        + "updatedAt='"
183        + updatedAt
184        + '\''
185        + ", "
186        + "createdBy='"
187        + createdBy
188        + '\''
189        + ", "
190        + "updatedBy='"
191        + updatedBy
192        + '\''
193        + ", "
194        + "workflow='"
195        + workflow
196        + '\''
197        + "}";
198  }
199
200  public static class Builder extends NullableFieldTracker {
201
202    protected final String id;
203
204    protected EnumWrapper<AutomateWorkflowActionV2026R0TypeField> type;
205
206    protected EnumWrapper<AutomateWorkflowActionV2026R0ActionTypeField> actionType;
207
208    protected String description;
209
210    protected OffsetDateTime createdAt;
211
212    protected OffsetDateTime updatedAt;
213
214    protected UserMiniV2026R0 createdBy;
215
216    protected UserMiniV2026R0 updatedBy;
217
218    protected final AutomateWorkflowReferenceV2026R0 workflow;
219
220    public Builder(String id, AutomateWorkflowReferenceV2026R0 workflow) {
221      super();
222      this.id = id;
223      this.workflow = workflow;
224    }
225
226    public Builder type(AutomateWorkflowActionV2026R0TypeField type) {
227      this.type = new EnumWrapper<AutomateWorkflowActionV2026R0TypeField>(type);
228      return this;
229    }
230
231    public Builder type(EnumWrapper<AutomateWorkflowActionV2026R0TypeField> type) {
232      this.type = type;
233      return this;
234    }
235
236    public Builder actionType(AutomateWorkflowActionV2026R0ActionTypeField actionType) {
237      this.actionType = new EnumWrapper<AutomateWorkflowActionV2026R0ActionTypeField>(actionType);
238      return this;
239    }
240
241    public Builder actionType(
242        EnumWrapper<AutomateWorkflowActionV2026R0ActionTypeField> actionType) {
243      this.actionType = actionType;
244      return this;
245    }
246
247    public Builder description(String description) {
248      this.description = description;
249      return this;
250    }
251
252    public Builder createdAt(OffsetDateTime createdAt) {
253      this.createdAt = createdAt;
254      return this;
255    }
256
257    public Builder updatedAt(OffsetDateTime updatedAt) {
258      this.updatedAt = updatedAt;
259      return this;
260    }
261
262    public Builder createdBy(UserMiniV2026R0 createdBy) {
263      this.createdBy = createdBy;
264      return this;
265    }
266
267    public Builder updatedBy(UserMiniV2026R0 updatedBy) {
268      this.updatedBy = updatedBy;
269      return this;
270    }
271
272    public AutomateWorkflowActionV2026R0 build() {
273      if (this.type == null) {
274        this.type =
275            new EnumWrapper<AutomateWorkflowActionV2026R0TypeField>(
276                AutomateWorkflowActionV2026R0TypeField.WORKFLOW_ACTION);
277      }
278      if (this.actionType == null) {
279        this.actionType =
280            new EnumWrapper<AutomateWorkflowActionV2026R0ActionTypeField>(
281                AutomateWorkflowActionV2026R0ActionTypeField.RUN_WORKFLOW);
282      }
283      return new AutomateWorkflowActionV2026R0(this);
284    }
285  }
286}