001package com.box.sdkgen.schemas.workflow;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import com.fasterxml.jackson.annotation.JsonProperty;
008import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
009import com.fasterxml.jackson.databind.annotation.JsonSerialize;
010import java.util.List;
011import java.util.Objects;
012
013@JsonFilter("nullablePropertyFilter")
014public class WorkflowFlowsOutcomesField extends SerializableObject {
015
016  /** The identifier of the outcome. */
017  protected String id;
018
019  /** The outcomes resource type. */
020  @JsonDeserialize(
021      using = WorkflowFlowsOutcomesTypeField.WorkflowFlowsOutcomesTypeFieldDeserializer.class)
022  @JsonSerialize(
023      using = WorkflowFlowsOutcomesTypeField.WorkflowFlowsOutcomesTypeFieldSerializer.class)
024  protected EnumWrapper<WorkflowFlowsOutcomesTypeField> type;
025
026  /** The name of the outcome. */
027  protected String name;
028
029  @JsonDeserialize(
030      using =
031          WorkflowFlowsOutcomesActionTypeField.WorkflowFlowsOutcomesActionTypeFieldDeserializer
032              .class)
033  @JsonSerialize(
034      using =
035          WorkflowFlowsOutcomesActionTypeField.WorkflowFlowsOutcomesActionTypeFieldSerializer.class)
036  @JsonProperty("action_type")
037  protected EnumWrapper<WorkflowFlowsOutcomesActionTypeField> actionType;
038
039  /**
040   * If `action_type` is `assign_task` and the task is rejected, returns a list of outcomes to
041   * complete.
042   */
043  @JsonProperty("if_rejected")
044  protected List<WorkflowFlowsOutcomesIfRejectedField> ifRejected;
045
046  public WorkflowFlowsOutcomesField() {
047    super();
048  }
049
050  protected WorkflowFlowsOutcomesField(Builder builder) {
051    super();
052    this.id = builder.id;
053    this.type = builder.type;
054    this.name = builder.name;
055    this.actionType = builder.actionType;
056    this.ifRejected = builder.ifRejected;
057    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
058  }
059
060  public String getId() {
061    return id;
062  }
063
064  public EnumWrapper<WorkflowFlowsOutcomesTypeField> getType() {
065    return type;
066  }
067
068  public String getName() {
069    return name;
070  }
071
072  public EnumWrapper<WorkflowFlowsOutcomesActionTypeField> getActionType() {
073    return actionType;
074  }
075
076  public List<WorkflowFlowsOutcomesIfRejectedField> getIfRejected() {
077    return ifRejected;
078  }
079
080  @Override
081  public boolean equals(Object o) {
082    if (this == o) {
083      return true;
084    }
085    if (o == null || getClass() != o.getClass()) {
086      return false;
087    }
088    WorkflowFlowsOutcomesField casted = (WorkflowFlowsOutcomesField) o;
089    return Objects.equals(id, casted.id)
090        && Objects.equals(type, casted.type)
091        && Objects.equals(name, casted.name)
092        && Objects.equals(actionType, casted.actionType)
093        && Objects.equals(ifRejected, casted.ifRejected);
094  }
095
096  @Override
097  public int hashCode() {
098    return Objects.hash(id, type, name, actionType, ifRejected);
099  }
100
101  @Override
102  public String toString() {
103    return "WorkflowFlowsOutcomesField{"
104        + "id='"
105        + id
106        + '\''
107        + ", "
108        + "type='"
109        + type
110        + '\''
111        + ", "
112        + "name='"
113        + name
114        + '\''
115        + ", "
116        + "actionType='"
117        + actionType
118        + '\''
119        + ", "
120        + "ifRejected='"
121        + ifRejected
122        + '\''
123        + "}";
124  }
125
126  public static class Builder extends NullableFieldTracker {
127
128    protected String id;
129
130    protected EnumWrapper<WorkflowFlowsOutcomesTypeField> type;
131
132    protected String name;
133
134    protected EnumWrapper<WorkflowFlowsOutcomesActionTypeField> actionType;
135
136    protected List<WorkflowFlowsOutcomesIfRejectedField> ifRejected;
137
138    public Builder id(String id) {
139      this.id = id;
140      return this;
141    }
142
143    public Builder type(WorkflowFlowsOutcomesTypeField type) {
144      this.type = new EnumWrapper<WorkflowFlowsOutcomesTypeField>(type);
145      return this;
146    }
147
148    public Builder type(EnumWrapper<WorkflowFlowsOutcomesTypeField> type) {
149      this.type = type;
150      return this;
151    }
152
153    public Builder name(String name) {
154      this.name = name;
155      return this;
156    }
157
158    public Builder actionType(WorkflowFlowsOutcomesActionTypeField actionType) {
159      this.actionType = new EnumWrapper<WorkflowFlowsOutcomesActionTypeField>(actionType);
160      return this;
161    }
162
163    public Builder actionType(EnumWrapper<WorkflowFlowsOutcomesActionTypeField> actionType) {
164      this.actionType = actionType;
165      return this;
166    }
167
168    public Builder ifRejected(List<WorkflowFlowsOutcomesIfRejectedField> ifRejected) {
169      this.ifRejected = ifRejected;
170      return this;
171    }
172
173    public WorkflowFlowsOutcomesField build() {
174      return new WorkflowFlowsOutcomesField(this);
175    }
176  }
177}