package org.wfc.omada.api.sitesetting.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Pattern;
import java.util.Objects;

/**
 * NewIpsAllowListEntry
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-12-04T11:32:19.054+08:00[Asia/Shanghai]")

public class NewIpsAllowListEntry   {
  @JsonProperty("direction")
  private Integer direction;

  @JsonProperty("trafficType")
  private Integer trafficType;

  @JsonProperty("ipAddress")
  private String ipAddress;

  @JsonProperty("network")
  private String network;

  @JsonProperty("subnet")
  private String subnet;

  public NewIpsAllowListEntry direction(Integer direction) {
    this.direction = direction;
    return this;
  }

  /**
   * The location of the target that can trigger the threat, direction should be a value as follows:0: both 1: source, 2: destination.
   * @return direction
  */
  @ApiModelProperty(value = "The location of the target that can trigger the threat, direction should be a value as follows:0: both 1: source, 2: destination.")


  public Integer getDirection() {
    return direction;
  }

  public void setDirection(Integer direction) {
    this.direction = direction;
  }

  public NewIpsAllowListEntry trafficType(Integer trafficType) {
    this.trafficType = trafficType;
    return this;
  }

  /**
   * Exempt the category of objects (targets) that can trigger the threat, trafficType should be a value as follows: 0: IP Address, 1: Network, 2: Subnet.
   * @return trafficType
  */
  @ApiModelProperty(value = "Exempt the category of objects (targets) that can trigger the threat, trafficType should be a value as follows: 0: IP Address, 1: Network, 2: Subnet.")


  public Integer getTrafficType() {
    return trafficType;
  }

  public void setTrafficType(Integer trafficType) {
    this.trafficType = trafficType;
  }

  public NewIpsAllowListEntry ipAddress(String ipAddress) {
    this.ipAddress = ipAddress;
    return this;
  }

  /**
   * The value of the trafficType is 0, indicating IP address.
   * @return ipAddress
  */
  @ApiModelProperty(value = "The value of the trafficType is 0, indicating IP address.")

@Pattern(regexp="\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b") 
  public String getIpAddress() {
    return ipAddress;
  }

  public void setIpAddress(String ipAddress) {
    this.ipAddress = ipAddress;
  }

  public NewIpsAllowListEntry network(String network) {
    this.network = network;
    return this;
  }

  /**
   * The value of the trafficType is 1, indicating LAN network ID.
   * @return network
  */
  @ApiModelProperty(value = "The value of the trafficType is 1, indicating LAN network ID.")


  public String getNetwork() {
    return network;
  }

  public void setNetwork(String network) {
    this.network = network;
  }

  public NewIpsAllowListEntry subnet(String subnet) {
    this.subnet = subnet;
    return this;
  }

  /**
   * The value of the trafficType is 2, indicating subnet.
   * @return subnet
  */
  @ApiModelProperty(value = "The value of the trafficType is 2, indicating subnet.")

@Pattern(regexp="\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])/([1-9]|((1|2)\\d)|(30|31|32))\\b") 
  public String getSubnet() {
    return subnet;
  }

  public void setSubnet(String subnet) {
    this.subnet = subnet;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    NewIpsAllowListEntry newIpsAllowListEntry = (NewIpsAllowListEntry) o;
    return Objects.equals(this.direction, newIpsAllowListEntry.direction) &&
        Objects.equals(this.trafficType, newIpsAllowListEntry.trafficType) &&
        Objects.equals(this.ipAddress, newIpsAllowListEntry.ipAddress) &&
        Objects.equals(this.network, newIpsAllowListEntry.network) &&
        Objects.equals(this.subnet, newIpsAllowListEntry.subnet);
  }

  @Override
  public int hashCode() {
    return Objects.hash(direction, trafficType, ipAddress, network, subnet);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class NewIpsAllowListEntry {\n");
    
    sb.append("    direction: ").append(toIndentedString(direction)).append("\n");
    sb.append("    trafficType: ").append(toIndentedString(trafficType)).append("\n");
    sb.append("    ipAddress: ").append(toIndentedString(ipAddress)).append("\n");
    sb.append("    network: ").append(toIndentedString(network)).append("\n");
    sb.append("    subnet: ").append(toIndentedString(subnet)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}

