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;

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

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

  @JsonProperty("status")
  private Boolean status;

  @JsonProperty("sourceType")
  private Integer sourceType;

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

  @JsonProperty("ip")
  private String ip;

  @JsonProperty("maxSession")
  private Integer maxSession;

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

  /**
   * Name should contain 1 to 64 characters.
   * @return name
  */
  @ApiModelProperty(required = true, value = "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 SessionLimitRuleOpenApiVo status(Boolean status) {
    this.status = status;
    return this;
  }

  /**
   * Status of the session limit rule.
   * @return status
  */
  @ApiModelProperty(required = true, value = "Status of the session limit rule.")
  @NotNull


  public Boolean getStatus() {
    return status;
  }

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

  public SessionLimitRuleOpenApiVo sourceType(Integer sourceType) {
    this.sourceType = sourceType;
    return this;
  }

  /**
   * Source type should be a value as follows: 0: network; 1: IP group; 2: IP.
   * @return sourceType
  */
  @ApiModelProperty(required = true, value = "Source type should be a value as follows: 0: network; 1: IP group; 2: IP.")
  @NotNull


  public Integer getSourceType() {
    return sourceType;
  }

  public void setSourceType(Integer sourceType) {
    this.sourceType = sourceType;
  }

  public SessionLimitRuleOpenApiVo sourceIds(List<String> sourceIds) {
    this.sourceIds = sourceIds;
    return this;
  }

  public SessionLimitRuleOpenApiVo addSourceIdsItem(String sourceIdsItem) {
    if (this.sourceIds == null) {
      this.sourceIds = new ArrayList<>();
    }
    this.sourceIds.add(sourceIdsItem);
    return this;
  }

  /**
   * Source IDs of the session limit rule, only for network and IP group type.Network can be created using 'Create LAN network' interface, and network ID can be obtained from 'Get LAN network list' interface. IP group can be created using 'Create a new group profile' interface, and IP group ID can be obtained from 'Get group profile list' interface.
   * @return sourceIds
  */
  @ApiModelProperty(value = "Source IDs of the session limit rule, only for network and IP group type.Network can be created using 'Create LAN network' interface, and network ID can be obtained from 'Get LAN network list' interface. IP group can be created using 'Create a new group profile' interface, and IP group ID can be obtained from 'Get group profile list' interface.")


  public List<String> getSourceIds() {
    return sourceIds;
  }

  public void setSourceIds(List<String> sourceIds) {
    this.sourceIds = sourceIds;
  }

  public SessionLimitRuleOpenApiVo ip(String ip) {
    this.ip = ip;
    return this;
  }

  /**
   * IP of the session limit rule.
   * @return ip
  */
  @ApiModelProperty(value = "IP of the session limit rule.")

@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 getIp() {
    return ip;
  }

  public void setIp(String ip) {
    this.ip = ip;
  }

  public SessionLimitRuleOpenApiVo maxSession(Integer maxSession) {
    this.maxSession = maxSession;
    return this;
  }

  /**
   * Max sessions should be within the range of 1–999999.
   * @return maxSession
  */
  @ApiModelProperty(required = true, value = "Max sessions should be within the range of 1–999999.")
  @NotNull


  public Integer getMaxSession() {
    return maxSession;
  }

  public void setMaxSession(Integer maxSession) {
    this.maxSession = maxSession;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    SessionLimitRuleOpenApiVo sessionLimitRuleOpenApiVo = (SessionLimitRuleOpenApiVo) o;
    return Objects.equals(this.name, sessionLimitRuleOpenApiVo.name) &&
        Objects.equals(this.status, sessionLimitRuleOpenApiVo.status) &&
        Objects.equals(this.sourceType, sessionLimitRuleOpenApiVo.sourceType) &&
        Objects.equals(this.sourceIds, sessionLimitRuleOpenApiVo.sourceIds) &&
        Objects.equals(this.ip, sessionLimitRuleOpenApiVo.ip) &&
        Objects.equals(this.maxSession, sessionLimitRuleOpenApiVo.maxSession);
  }

  @Override
  public int hashCode() {
    return Objects.hash(name, status, sourceType, sourceIds, ip, maxSession);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class SessionLimitRuleOpenApiVo {\n");
    
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    status: ").append(toIndentedString(status)).append("\n");
    sb.append("    sourceType: ").append(toIndentedString(sourceType)).append("\n");
    sb.append("    sourceIds: ").append(toIndentedString(sourceIds)).append("\n");
    sb.append("    ip: ").append(toIndentedString(ip)).append("\n");
    sb.append("    maxSession: ").append(toIndentedString(maxSession)).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    ");
  }
}

