001package com.box.sdkgen.schemas.v2025r0.shieldruleitemv2025r0;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.box.sdkgen.internal.utils.DateTimeUtils;
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.time.OffsetDateTime;
012import java.util.Objects;
013
014/** A Shield rule item. */
015@JsonFilter("nullablePropertyFilter")
016public class ShieldRuleItemV2025R0 extends SerializableObject {
017
018  /** The identifier of the shield rule. */
019  protected String id;
020
021  /** The value will always be `shield_rule`. */
022  @JsonDeserialize(
023      using = ShieldRuleItemV2025R0TypeField.ShieldRuleItemV2025R0TypeFieldDeserializer.class)
024  @JsonSerialize(
025      using = ShieldRuleItemV2025R0TypeField.ShieldRuleItemV2025R0TypeFieldSerializer.class)
026  protected EnumWrapper<ShieldRuleItemV2025R0TypeField> type;
027
028  /** The category of the shield rule. */
029  @JsonProperty("rule_category")
030  protected String ruleCategory;
031
032  /** The name of the shield rule. */
033  protected String name;
034
035  /** The description of the shield rule. */
036  protected String description;
037
038  /** The priority level of the shield rule. */
039  @JsonDeserialize(
040      using =
041          ShieldRuleItemV2025R0PriorityField.ShieldRuleItemV2025R0PriorityFieldDeserializer.class)
042  @JsonSerialize(
043      using = ShieldRuleItemV2025R0PriorityField.ShieldRuleItemV2025R0PriorityFieldSerializer.class)
044  protected EnumWrapper<ShieldRuleItemV2025R0PriorityField> priority;
045
046  /** The date and time when the shield rule was created. */
047  @JsonProperty("created_at")
048  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
049  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
050  protected OffsetDateTime createdAt;
051
052  /** The date and time when the shield rule was last modified. */
053  @JsonProperty("modified_at")
054  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
055  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
056  protected OffsetDateTime modifiedAt;
057
058  public ShieldRuleItemV2025R0() {
059    super();
060  }
061
062  protected ShieldRuleItemV2025R0(Builder builder) {
063    super();
064    this.id = builder.id;
065    this.type = builder.type;
066    this.ruleCategory = builder.ruleCategory;
067    this.name = builder.name;
068    this.description = builder.description;
069    this.priority = builder.priority;
070    this.createdAt = builder.createdAt;
071    this.modifiedAt = builder.modifiedAt;
072    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
073  }
074
075  public String getId() {
076    return id;
077  }
078
079  public EnumWrapper<ShieldRuleItemV2025R0TypeField> getType() {
080    return type;
081  }
082
083  public String getRuleCategory() {
084    return ruleCategory;
085  }
086
087  public String getName() {
088    return name;
089  }
090
091  public String getDescription() {
092    return description;
093  }
094
095  public EnumWrapper<ShieldRuleItemV2025R0PriorityField> getPriority() {
096    return priority;
097  }
098
099  public OffsetDateTime getCreatedAt() {
100    return createdAt;
101  }
102
103  public OffsetDateTime getModifiedAt() {
104    return modifiedAt;
105  }
106
107  @Override
108  public boolean equals(Object o) {
109    if (this == o) {
110      return true;
111    }
112    if (o == null || getClass() != o.getClass()) {
113      return false;
114    }
115    ShieldRuleItemV2025R0 casted = (ShieldRuleItemV2025R0) o;
116    return Objects.equals(id, casted.id)
117        && Objects.equals(type, casted.type)
118        && Objects.equals(ruleCategory, casted.ruleCategory)
119        && Objects.equals(name, casted.name)
120        && Objects.equals(description, casted.description)
121        && Objects.equals(priority, casted.priority)
122        && Objects.equals(createdAt, casted.createdAt)
123        && Objects.equals(modifiedAt, casted.modifiedAt);
124  }
125
126  @Override
127  public int hashCode() {
128    return Objects.hash(id, type, ruleCategory, name, description, priority, createdAt, modifiedAt);
129  }
130
131  @Override
132  public String toString() {
133    return "ShieldRuleItemV2025R0{"
134        + "id='"
135        + id
136        + '\''
137        + ", "
138        + "type='"
139        + type
140        + '\''
141        + ", "
142        + "ruleCategory='"
143        + ruleCategory
144        + '\''
145        + ", "
146        + "name='"
147        + name
148        + '\''
149        + ", "
150        + "description='"
151        + description
152        + '\''
153        + ", "
154        + "priority='"
155        + priority
156        + '\''
157        + ", "
158        + "createdAt='"
159        + createdAt
160        + '\''
161        + ", "
162        + "modifiedAt='"
163        + modifiedAt
164        + '\''
165        + "}";
166  }
167
168  public static class Builder extends NullableFieldTracker {
169
170    protected String id;
171
172    protected EnumWrapper<ShieldRuleItemV2025R0TypeField> type;
173
174    protected String ruleCategory;
175
176    protected String name;
177
178    protected String description;
179
180    protected EnumWrapper<ShieldRuleItemV2025R0PriorityField> priority;
181
182    protected OffsetDateTime createdAt;
183
184    protected OffsetDateTime modifiedAt;
185
186    public Builder id(String id) {
187      this.id = id;
188      return this;
189    }
190
191    public Builder type(ShieldRuleItemV2025R0TypeField type) {
192      this.type = new EnumWrapper<ShieldRuleItemV2025R0TypeField>(type);
193      return this;
194    }
195
196    public Builder type(EnumWrapper<ShieldRuleItemV2025R0TypeField> type) {
197      this.type = type;
198      return this;
199    }
200
201    public Builder ruleCategory(String ruleCategory) {
202      this.ruleCategory = ruleCategory;
203      return this;
204    }
205
206    public Builder name(String name) {
207      this.name = name;
208      return this;
209    }
210
211    public Builder description(String description) {
212      this.description = description;
213      return this;
214    }
215
216    public Builder priority(ShieldRuleItemV2025R0PriorityField priority) {
217      this.priority = new EnumWrapper<ShieldRuleItemV2025R0PriorityField>(priority);
218      return this;
219    }
220
221    public Builder priority(EnumWrapper<ShieldRuleItemV2025R0PriorityField> priority) {
222      this.priority = priority;
223      return this;
224    }
225
226    public Builder createdAt(OffsetDateTime createdAt) {
227      this.createdAt = createdAt;
228      return this;
229    }
230
231    public Builder modifiedAt(OffsetDateTime modifiedAt) {
232      this.modifiedAt = modifiedAt;
233      return this;
234    }
235
236    public ShieldRuleItemV2025R0 build() {
237      return new ShieldRuleItemV2025R0(this);
238    }
239  }
240}