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

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

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

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

public class ExternalServerPortalSetting   {
  @JsonProperty("hostType")
  private Integer hostType;

  @JsonProperty("serverIp")
  private String serverIp;

  @JsonProperty("serverPort")
  private Integer serverPort;

  @JsonProperty("serverUrlScheme")
  private String serverUrlScheme;

  @JsonProperty("serverUrl")
  private String serverUrl;

  public ExternalServerPortalSetting hostType(Integer hostType) {
    this.hostType = hostType;
    return this;
  }

  /**
   * Host type, should be a value as follows: 1: IP; 2: URL
   * @return hostType
  */
  @ApiModelProperty(required = true, value = "Host type, should be a value as follows: 1: IP; 2: URL")
  @NotNull


  public Integer getHostType() {
    return hostType;
  }

  public void setHostType(Integer hostType) {
    this.hostType = hostType;
  }

  public ExternalServerPortalSetting serverIp(String serverIp) {
    this.serverIp = serverIp;
    return this;
  }

  /**
   * Server IP, required when [hostType] is 1, pattern as \"xx.xx.xx.xx\".
   * @return serverIp
  */
  @ApiModelProperty(value = "Server IP, required when [hostType] is 1, pattern as \"xx.xx.xx.xx\".")

@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 getServerIp() {
    return serverIp;
  }

  public void setServerIp(String serverIp) {
    this.serverIp = serverIp;
  }

  public ExternalServerPortalSetting serverPort(Integer serverPort) {
    this.serverPort = serverPort;
    return this;
  }

  /**
   * Server port, required when [hostType] is 1, from 1 to 65535.
   * @return serverPort
  */
  @ApiModelProperty(value = "Server port, required when [hostType] is 1, from 1 to 65535.")


  public Integer getServerPort() {
    return serverPort;
  }

  public void setServerPort(Integer serverPort) {
    this.serverPort = serverPort;
  }

  public ExternalServerPortalSetting serverUrlScheme(String serverUrlScheme) {
    this.serverUrlScheme = serverUrlScheme;
    return this;
  }

  /**
   * Server url scheme, required when [hostType] is 2, value is http or https.
   * @return serverUrlScheme
  */
  @ApiModelProperty(value = "Server url scheme, required when [hostType] is 2, value is http or https.")

@Pattern(regexp="http|https") 
  public String getServerUrlScheme() {
    return serverUrlScheme;
  }

  public void setServerUrlScheme(String serverUrlScheme) {
    this.serverUrlScheme = serverUrlScheme;
  }

  public ExternalServerPortalSetting serverUrl(String serverUrl) {
    this.serverUrl = serverUrl;
    return this;
  }

  /**
   * Server url, required when [hostType] is 2.
   * @return serverUrl
  */
  @ApiModelProperty(value = "Server url, required when [hostType] is 2.")

@Pattern(regexp="^(([-a-zA-Z0-9@:%._+~#=]{2,256}\\.[a-z]{2,63})|(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.)){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))((:([1-9]|[1-9]\\d|[1-9]\\d{2}|[1-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5]))?)(/([-a-zA-Z0-9@:%_+.~#?&//=]*))?$") 
  public String getServerUrl() {
    return serverUrl;
  }

  public void setServerUrl(String serverUrl) {
    this.serverUrl = serverUrl;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ExternalServerPortalSetting externalServerPortalSetting = (ExternalServerPortalSetting) o;
    return Objects.equals(this.hostType, externalServerPortalSetting.hostType) &&
        Objects.equals(this.serverIp, externalServerPortalSetting.serverIp) &&
        Objects.equals(this.serverPort, externalServerPortalSetting.serverPort) &&
        Objects.equals(this.serverUrlScheme, externalServerPortalSetting.serverUrlScheme) &&
        Objects.equals(this.serverUrl, externalServerPortalSetting.serverUrl);
  }

  @Override
  public int hashCode() {
    return Objects.hash(hostType, serverIp, serverPort, serverUrlScheme, serverUrl);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ExternalServerPortalSetting {\n");
    
    sb.append("    hostType: ").append(toIndentedString(hostType)).append("\n");
    sb.append("    serverIp: ").append(toIndentedString(serverIp)).append("\n");
    sb.append("    serverPort: ").append(toIndentedString(serverPort)).append("\n");
    sb.append("    serverUrlScheme: ").append(toIndentedString(serverUrlScheme)).append("\n");
    sb.append("    serverUrl: ").append(toIndentedString(serverUrl)).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    ");
  }
}

