001package com.box.sdkgen.schemas.v2025r0.shieldlistcontentipv2025r0;
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/** Representation of content of a Shield List that contains ip addresses data. */
014@JsonFilter("nullablePropertyFilter")
015public class ShieldListContentIpV2025R0 extends SerializableObject {
016
017  /** The type of content in the shield list. */
018  @JsonDeserialize(
019      using =
020          ShieldListContentIpV2025R0TypeField.ShieldListContentIpV2025R0TypeFieldDeserializer.class)
021  @JsonSerialize(
022      using =
023          ShieldListContentIpV2025R0TypeField.ShieldListContentIpV2025R0TypeFieldSerializer.class)
024  protected EnumWrapper<ShieldListContentIpV2025R0TypeField> type;
025
026  /** List of ip addresses and CIDRs. */
027  @JsonProperty("ip_addresses")
028  protected final List<String> ipAddresses;
029
030  public ShieldListContentIpV2025R0(@JsonProperty("ip_addresses") List<String> ipAddresses) {
031    super();
032    this.ipAddresses = ipAddresses;
033    this.type =
034        new EnumWrapper<ShieldListContentIpV2025R0TypeField>(
035            ShieldListContentIpV2025R0TypeField.IP);
036  }
037
038  protected ShieldListContentIpV2025R0(Builder builder) {
039    super();
040    this.type = builder.type;
041    this.ipAddresses = builder.ipAddresses;
042    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
043  }
044
045  public EnumWrapper<ShieldListContentIpV2025R0TypeField> getType() {
046    return type;
047  }
048
049  public List<String> getIpAddresses() {
050    return ipAddresses;
051  }
052
053  @Override
054  public boolean equals(Object o) {
055    if (this == o) {
056      return true;
057    }
058    if (o == null || getClass() != o.getClass()) {
059      return false;
060    }
061    ShieldListContentIpV2025R0 casted = (ShieldListContentIpV2025R0) o;
062    return Objects.equals(type, casted.type) && Objects.equals(ipAddresses, casted.ipAddresses);
063  }
064
065  @Override
066  public int hashCode() {
067    return Objects.hash(type, ipAddresses);
068  }
069
070  @Override
071  public String toString() {
072    return "ShieldListContentIpV2025R0{"
073        + "type='"
074        + type
075        + '\''
076        + ", "
077        + "ipAddresses='"
078        + ipAddresses
079        + '\''
080        + "}";
081  }
082
083  public static class Builder extends NullableFieldTracker {
084
085    protected EnumWrapper<ShieldListContentIpV2025R0TypeField> type;
086
087    protected final List<String> ipAddresses;
088
089    public Builder(List<String> ipAddresses) {
090      super();
091      this.ipAddresses = ipAddresses;
092    }
093
094    public Builder type(ShieldListContentIpV2025R0TypeField type) {
095      this.type = new EnumWrapper<ShieldListContentIpV2025R0TypeField>(type);
096      return this;
097    }
098
099    public Builder type(EnumWrapper<ShieldListContentIpV2025R0TypeField> type) {
100      this.type = type;
101      return this;
102    }
103
104    public ShieldListContentIpV2025R0 build() {
105      if (this.type == null) {
106        this.type =
107            new EnumWrapper<ShieldListContentIpV2025R0TypeField>(
108                ShieldListContentIpV2025R0TypeField.IP);
109      }
110      return new ShieldListContentIpV2025R0(this);
111    }
112  }
113}