001package com.box.sdkgen.schemas.trackingcode;
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/**
012 * Tracking codes allow an admin to generate reports from the admin console and assign an attribute
013 * to a specific group of users. This setting must be enabled for an enterprise before it can be
014 * used.
015 */
016@JsonFilter("nullablePropertyFilter")
017public class TrackingCode extends SerializableObject {
018
019  /** The value will always be `tracking_code`. */
020  @JsonDeserialize(using = TrackingCodeTypeField.TrackingCodeTypeFieldDeserializer.class)
021  @JsonSerialize(using = TrackingCodeTypeField.TrackingCodeTypeFieldSerializer.class)
022  protected EnumWrapper<TrackingCodeTypeField> type;
023
024  /** The name of the tracking code, which must be preconfigured in the Admin Console. */
025  protected String name;
026
027  /** The value of the tracking code. */
028  protected String value;
029
030  public TrackingCode() {
031    super();
032  }
033
034  protected TrackingCode(Builder builder) {
035    super();
036    this.type = builder.type;
037    this.name = builder.name;
038    this.value = builder.value;
039    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
040  }
041
042  public EnumWrapper<TrackingCodeTypeField> getType() {
043    return type;
044  }
045
046  public String getName() {
047    return name;
048  }
049
050  public String getValue() {
051    return value;
052  }
053
054  @Override
055  public boolean equals(Object o) {
056    if (this == o) {
057      return true;
058    }
059    if (o == null || getClass() != o.getClass()) {
060      return false;
061    }
062    TrackingCode casted = (TrackingCode) o;
063    return Objects.equals(type, casted.type)
064        && Objects.equals(name, casted.name)
065        && Objects.equals(value, casted.value);
066  }
067
068  @Override
069  public int hashCode() {
070    return Objects.hash(type, name, value);
071  }
072
073  @Override
074  public String toString() {
075    return "TrackingCode{"
076        + "type='"
077        + type
078        + '\''
079        + ", "
080        + "name='"
081        + name
082        + '\''
083        + ", "
084        + "value='"
085        + value
086        + '\''
087        + "}";
088  }
089
090  public static class Builder extends NullableFieldTracker {
091
092    protected EnumWrapper<TrackingCodeTypeField> type;
093
094    protected String name;
095
096    protected String value;
097
098    public Builder type(TrackingCodeTypeField type) {
099      this.type = new EnumWrapper<TrackingCodeTypeField>(type);
100      return this;
101    }
102
103    public Builder type(EnumWrapper<TrackingCodeTypeField> type) {
104      this.type = type;
105      return this;
106    }
107
108    public Builder name(String name) {
109      this.name = name;
110      return this;
111    }
112
113    public Builder value(String value) {
114      this.value = value;
115      return this;
116    }
117
118    public TrackingCode build() {
119      return new TrackingCode(this);
120    }
121  }
122}