001package com.box.sdkgen.schemas.webhookmini;
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.databind.annotation.JsonDeserialize;
008import com.fasterxml.jackson.databind.annotation.JsonSerialize;
009import java.util.Objects;
010
011/** Represents a configured webhook. */
012@JsonFilter("nullablePropertyFilter")
013public class WebhookMini extends SerializableObject {
014
015  /** The unique identifier for this webhook. */
016  protected String id;
017
018  /** The value will always be `webhook`. */
019  @JsonDeserialize(using = WebhookMiniTypeField.WebhookMiniTypeFieldDeserializer.class)
020  @JsonSerialize(using = WebhookMiniTypeField.WebhookMiniTypeFieldSerializer.class)
021  protected EnumWrapper<WebhookMiniTypeField> type;
022
023  /** The item that will trigger the webhook. */
024  protected WebhookMiniTargetField target;
025
026  public WebhookMini() {
027    super();
028  }
029
030  protected WebhookMini(Builder builder) {
031    super();
032    this.id = builder.id;
033    this.type = builder.type;
034    this.target = builder.target;
035    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
036  }
037
038  public String getId() {
039    return id;
040  }
041
042  public EnumWrapper<WebhookMiniTypeField> getType() {
043    return type;
044  }
045
046  public WebhookMiniTargetField getTarget() {
047    return target;
048  }
049
050  @Override
051  public boolean equals(Object o) {
052    if (this == o) {
053      return true;
054    }
055    if (o == null || getClass() != o.getClass()) {
056      return false;
057    }
058    WebhookMini casted = (WebhookMini) o;
059    return Objects.equals(id, casted.id)
060        && Objects.equals(type, casted.type)
061        && Objects.equals(target, casted.target);
062  }
063
064  @Override
065  public int hashCode() {
066    return Objects.hash(id, type, target);
067  }
068
069  @Override
070  public String toString() {
071    return "WebhookMini{"
072        + "id='"
073        + id
074        + '\''
075        + ", "
076        + "type='"
077        + type
078        + '\''
079        + ", "
080        + "target='"
081        + target
082        + '\''
083        + "}";
084  }
085
086  public static class Builder extends NullableFieldTracker {
087
088    protected String id;
089
090    protected EnumWrapper<WebhookMiniTypeField> type;
091
092    protected WebhookMiniTargetField target;
093
094    public Builder id(String id) {
095      this.id = id;
096      return this;
097    }
098
099    public Builder type(WebhookMiniTypeField type) {
100      this.type = new EnumWrapper<WebhookMiniTypeField>(type);
101      return this;
102    }
103
104    public Builder type(EnumWrapper<WebhookMiniTypeField> type) {
105      this.type = type;
106      return this;
107    }
108
109    public Builder target(WebhookMiniTargetField target) {
110      this.target = target;
111      return this;
112    }
113
114    public WebhookMini build() {
115      return new WebhookMini(this);
116    }
117  }
118}