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

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

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

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

public class PortForwardingConfig   {
  @JsonProperty("name")
  private String name;

  @JsonProperty("status")
  private Boolean status;

  @JsonProperty("from")
  private Integer from;

  @JsonProperty("limitedAddresses")
  @Valid
  private List<String> limitedAddresses = null;

  @JsonProperty("interfaceWanPortId")
  @Valid
  private List<String> interfaceWanPortId = new ArrayList<>();

  @JsonProperty("wanIps")
  @Valid
  private List<PortIpOpenApiVo> wanIps = null;

  @JsonProperty("externalPort")
  private String externalPort;

  @JsonProperty("forwardIp")
  private String forwardIp;

  @JsonProperty("forwardPort")
  private String forwardPort;

  @JsonProperty("protocol")
  private Integer protocol;

  @JsonProperty("dMZ")
  private Boolean dMZ;

  public PortForwardingConfig name(String name) {
    this.name = name;
    return this;
  }

  /**
   * Name, name should contain 1 to 64 characters.
   * @return name
  */
  @ApiModelProperty(required = true, value = "Name, name should contain 1 to 64 characters.")
  @NotNull

@Pattern(regexp="^[^ ]$|^[^ ].{0,62}[^ ]$") 
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public PortForwardingConfig status(Boolean status) {
    this.status = status;
    return this;
  }

  /**
   * Port-forwarding enable status.
   * @return status
  */
  @ApiModelProperty(required = true, value = "Port-forwarding enable status.")
  @NotNull


  public Boolean getStatus() {
    return status;
  }

  public void setStatus(Boolean status) {
    this.status = status;
  }

  public PortForwardingConfig from(Integer from) {
    this.from = from;
    return this;
  }

  /**
   * From corresponds with source IP in web. From should be a value as follows: 0: where; 1: limited address
   * @return from
  */
  @ApiModelProperty(required = true, value = "From corresponds with source IP in web. From should be a value as follows: 0: where; 1: limited address")
  @NotNull


  public Integer getFrom() {
    return from;
  }

  public void setFrom(Integer from) {
    this.from = from;
  }

  public PortForwardingConfig limitedAddresses(List<String> limitedAddresses) {
    this.limitedAddresses = limitedAddresses;
    return this;
  }

  public PortForwardingConfig addLimitedAddressesItem(String limitedAddressesItem) {
    if (this.limitedAddresses == null) {
      this.limitedAddresses = new ArrayList<>();
    }
    this.limitedAddresses.add(limitedAddressesItem);
    return this;
  }

  /**
   * Only for limited address
   * @return limitedAddresses
  */
  @ApiModelProperty(value = "Only for limited address")


  public List<String> getLimitedAddresses() {
    return limitedAddresses;
  }

  public void setLimitedAddresses(List<String> limitedAddresses) {
    this.limitedAddresses = limitedAddresses;
  }

  public PortForwardingConfig interfaceWanPortId(List<String> interfaceWanPortId) {
    this.interfaceWanPortId = interfaceWanPortId;
    return this;
  }

  public PortForwardingConfig addInterfaceWanPortIdItem(String interfaceWanPortIdItem) {
    this.interfaceWanPortId.add(interfaceWanPortIdItem);
    return this;
  }

  /**
   * This field represents WAN port ID. WAN port ID can be obtained from can be obtained from 'Get internet basic info' interface.
   * @return interfaceWanPortId
  */
  @ApiModelProperty(required = true, value = "This field represents WAN port ID. WAN port ID can be obtained from can be obtained from 'Get internet basic info' interface.")
  @NotNull


  public List<String> getInterfaceWanPortId() {
    return interfaceWanPortId;
  }

  public void setInterfaceWanPortId(List<String> interfaceWanPortId) {
    this.interfaceWanPortId = interfaceWanPortId;
  }

  public PortForwardingConfig wanIps(List<PortIpOpenApiVo> wanIps) {
    this.wanIps = wanIps;
    return this;
  }

  public PortForwardingConfig addWanIpsItem(PortIpOpenApiVo wanIpsItem) {
    if (this.wanIps == null) {
      this.wanIps = new ArrayList<>();
    }
    this.wanIps.add(wanIpsItem);
    return this;
  }

  /**
   * WAN IPs
   * @return wanIps
  */
  @ApiModelProperty(value = "WAN IPs")

  @Valid

  public List<PortIpOpenApiVo> getWanIps() {
    return wanIps;
  }

  public void setWanIps(List<PortIpOpenApiVo> wanIps) {
    this.wanIps = wanIps;
  }

  public PortForwardingConfig externalPort(String externalPort) {
    this.externalPort = externalPort;
    return this;
  }

  /**
   * External port corresponds with source port in web. External port should be within the range of 1–65535. Must be filled in when DMS is false.
   * @return externalPort
  */
  @ApiModelProperty(value = "External port corresponds with source port in web. External port should be within the range of 1–65535. Must be filled in when DMS is false.")

@Pattern(regexp="^(([1-9]\\d{0,3})|([1-5]\\d{4})|(6[0-4]\\d{3})|(65[0-4]\\d{2})|(655[0-2]\\d)|(6553[0-5]))|((([1-9]\\d{0,3})|([1-5]\\d{4})|(6[0-4]\\d{3})|(65[0-4]\\d{2})|(655[0-2]\\d)|(6553[0-5]))-(([1-9]\\d{0,3})|([1-5]\\d{4})|(6[0-4]\\d{3})|(65[0-4]\\d{2})|(655[0-2]\\d)|(6553[0-5])))$") 
  public String getExternalPort() {
    return externalPort;
  }

  public void setExternalPort(String externalPort) {
    this.externalPort = externalPort;
  }

  public PortForwardingConfig forwardIp(String forwardIp) {
    this.forwardIp = forwardIp;
    return this;
  }

  /**
   * Forward IP corresponds with destination IP in web. Forward IP
   * @return forwardIp
  */
  @ApiModelProperty(required = true, value = "Forward IP corresponds with destination IP in web. Forward IP")
  @NotNull

@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 getForwardIp() {
    return forwardIp;
  }

  public void setForwardIp(String forwardIp) {
    this.forwardIp = forwardIp;
  }

  public PortForwardingConfig forwardPort(String forwardPort) {
    this.forwardPort = forwardPort;
    return this;
  }

  /**
   * Forward port corresponds with destination port in web. Forward port should be 1 or 1-10, within the range of 1–65535. Must be filled in when DMS is false.
   * @return forwardPort
  */
  @ApiModelProperty(value = "Forward port corresponds with destination port in web. Forward port should be 1 or 1-10, within the range of 1–65535. Must be filled in when DMS is false.")

@Pattern(regexp="^(([1-9]\\d{0,3})|([1-5]\\d{4})|(6[0-4]\\d{3})|(65[0-4]\\d{2})|(655[0-2]\\d)|(6553[0-5]))|((([1-9]\\d{0,3})|([1-5]\\d{4})|(6[0-4]\\d{3})|(65[0-4]\\d{2})|(655[0-2]\\d)|(6553[0-5]))-(([1-9]\\d{0,3})|([1-5]\\d{4})|(6[0-4]\\d{3})|(65[0-4]\\d{2})|(655[0-2]\\d)|(6553[0-5])))$") 
  public String getForwardPort() {
    return forwardPort;
  }

  public void setForwardPort(String forwardPort) {
    this.forwardPort = forwardPort;
  }

  public PortForwardingConfig protocol(Integer protocol) {
    this.protocol = protocol;
    return this;
  }

  /**
   * Protocol should be a value as follows: 0: ALL; 1: TCP; 2: UDP. Must be filled in when DMS is false.
   * @return protocol
  */
  @ApiModelProperty(value = "Protocol should be a value as follows: 0: ALL; 1: TCP; 2: UDP. Must be filled in when DMS is false.")


  public Integer getProtocol() {
    return protocol;
  }

  public void setProtocol(Integer protocol) {
    this.protocol = protocol;
  }

  public PortForwardingConfig dMZ(Boolean dMZ) {
    this.dMZ = dMZ;
    return this;
  }

  /**
   * With DMZ enabled, all ports are open and the traffic from external network will be forwarded to the specific destination IP in the LAN.
   * @return dMZ
  */
  @ApiModelProperty(required = true, value = "With DMZ enabled, all ports are open and the traffic from external network will be forwarded to the specific destination IP in the LAN.")
  @NotNull


  public Boolean getdMZ() {
    return dMZ;
  }

  public void setdMZ(Boolean dMZ) {
    this.dMZ = dMZ;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    PortForwardingConfig portForwardingConfig = (PortForwardingConfig) o;
    return Objects.equals(this.name, portForwardingConfig.name) &&
        Objects.equals(this.status, portForwardingConfig.status) &&
        Objects.equals(this.from, portForwardingConfig.from) &&
        Objects.equals(this.limitedAddresses, portForwardingConfig.limitedAddresses) &&
        Objects.equals(this.interfaceWanPortId, portForwardingConfig.interfaceWanPortId) &&
        Objects.equals(this.wanIps, portForwardingConfig.wanIps) &&
        Objects.equals(this.externalPort, portForwardingConfig.externalPort) &&
        Objects.equals(this.forwardIp, portForwardingConfig.forwardIp) &&
        Objects.equals(this.forwardPort, portForwardingConfig.forwardPort) &&
        Objects.equals(this.protocol, portForwardingConfig.protocol) &&
        Objects.equals(this.dMZ, portForwardingConfig.dMZ);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, status, from, limitedAddresses, interfaceWanPortId, wanIps, externalPort, forwardIp, forwardPort, protocol, dMZ);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class PortForwardingConfig {\n");
    
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    from: ").append(toIndentedString(from)).append("\n");
    sb.append("    limitedAddresses: ").append(toIndentedString(limitedAddresses)).append("\n");
    sb.append("    interfaceWanPortId: ").append(toIndentedString(interfaceWanPortId)).append("\n");
    sb.append("    wanIps: ").append(toIndentedString(wanIps)).append("\n");
    sb.append("    externalPort: ").append(toIndentedString(externalPort)).append("\n");
    sb.append("    forwardIp: ").append(toIndentedString(forwardIp)).append("\n");
    sb.append("    forwardPort: ").append(toIndentedString(forwardPort)).append("\n");
    sb.append("    protocol: ").append(toIndentedString(protocol)).append("\n");
    sb.append("    dMZ: ").append(toIndentedString(dMZ)).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    ");
  }
}

