001package com.box.sdkgen.schemas.workflow;
002
003import com.box.sdkgen.schemas.workflowmini.WorkflowMini;
004import com.box.sdkgen.schemas.workflowmini.WorkflowMiniTypeField;
005import com.box.sdkgen.serialization.json.EnumWrapper;
006import com.fasterxml.jackson.annotation.JsonFilter;
007import java.util.List;
008import java.util.Objects;
009
010/**
011 * Box Relay Workflows are objects that represent a named collection of flows.
012 *
013 * <p>Your application must be authorized to use the `Manage Box Relay` application scope within the
014 * developer console in order to use this resource.
015 */
016@JsonFilter("nullablePropertyFilter")
017public class Workflow extends WorkflowMini {
018
019  /** A list of flows assigned to a workflow. */
020  protected List<WorkflowFlowsField> flows;
021
022  public Workflow() {
023    super();
024  }
025
026  protected Workflow(Builder builder) {
027    super(builder);
028    this.flows = builder.flows;
029    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
030  }
031
032  public List<WorkflowFlowsField> getFlows() {
033    return flows;
034  }
035
036  @Override
037  public boolean equals(Object o) {
038    if (this == o) {
039      return true;
040    }
041    if (o == null || getClass() != o.getClass()) {
042      return false;
043    }
044    Workflow casted = (Workflow) o;
045    return Objects.equals(id, casted.id)
046        && Objects.equals(type, casted.type)
047        && Objects.equals(name, casted.name)
048        && Objects.equals(description, casted.description)
049        && Objects.equals(isEnabled, casted.isEnabled)
050        && Objects.equals(flows, casted.flows);
051  }
052
053  @Override
054  public int hashCode() {
055    return Objects.hash(id, type, name, description, isEnabled, flows);
056  }
057
058  @Override
059  public String toString() {
060    return "Workflow{"
061        + "id='"
062        + id
063        + '\''
064        + ", "
065        + "type='"
066        + type
067        + '\''
068        + ", "
069        + "name='"
070        + name
071        + '\''
072        + ", "
073        + "description='"
074        + description
075        + '\''
076        + ", "
077        + "isEnabled='"
078        + isEnabled
079        + '\''
080        + ", "
081        + "flows='"
082        + flows
083        + '\''
084        + "}";
085  }
086
087  public static class Builder extends WorkflowMini.Builder {
088
089    protected List<WorkflowFlowsField> flows;
090
091    public Builder flows(List<WorkflowFlowsField> flows) {
092      this.flows = flows;
093      return this;
094    }
095
096    @Override
097    public Builder id(String id) {
098      this.id = id;
099      return this;
100    }
101
102    @Override
103    public Builder type(WorkflowMiniTypeField type) {
104      this.type = new EnumWrapper<WorkflowMiniTypeField>(type);
105      return this;
106    }
107
108    @Override
109    public Builder type(EnumWrapper<WorkflowMiniTypeField> type) {
110      this.type = type;
111      return this;
112    }
113
114    @Override
115    public Builder name(String name) {
116      this.name = name;
117      return this;
118    }
119
120    @Override
121    public Builder description(String description) {
122      this.description = description;
123      return this;
124    }
125
126    @Override
127    public Builder isEnabled(Boolean isEnabled) {
128      this.isEnabled = isEnabled;
129      return this;
130    }
131
132    public Workflow build() {
133      return new Workflow(this);
134    }
135  }
136}