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;

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

public class BandwidthControlRule   {
  @JsonProperty("id")
  private String id;

  @JsonProperty("name")
  private String name;

  @JsonProperty("index")
  private Integer index;

  @JsonProperty("status")
  private Boolean status;

  @JsonProperty("sourceType")
  private Integer sourceType;

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

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

  @JsonProperty("upstreamBandwidth")
  private Integer upstreamBandwidth;

  @JsonProperty("upstreamBandwidthUnit")
  private Integer upstreamBandwidthUnit;

  @JsonProperty("downstreamBandwidth")
  private Integer downstreamBandwidth;

  @JsonProperty("downstreamBandwidthUnit")
  private Integer downstreamBandwidthUnit;

  @JsonProperty("mode")
  private Integer mode;

  public BandwidthControlRule id(String id) {
    this.id = id;
    return this;
  }

  /**
   * ID of the bandwidth control rule.
   * @return id
  */
  @ApiModelProperty(value = "ID of the bandwidth control rule.")


  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public BandwidthControlRule 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 BandwidthControlRule index(Integer index) {
    this.index = index;
    return this;
  }

  /**
   * Index of the bandwidth control rule.
   * @return index
  */
  @ApiModelProperty(value = "Index of the bandwidth control rule.")


  public Integer getIndex() {
    return index;
  }

  public void setIndex(Integer index) {
    this.index = index;
  }

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

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


  public Boolean getStatus() {
    return status;
  }

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

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

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


  public Integer getSourceType() {
    return sourceType;
  }

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

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

  public BandwidthControlRule addSourceIdsItem(String sourceIdsItem) {
    this.sourceIds.add(sourceIdsItem);
    return this;
  }

  /**
   * Source IDs of the bandwidth control rule. 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(required = true, value = "Source IDs of the bandwidth control rule. 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.")
  @NotNull


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

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

  public BandwidthControlRule wanPortIds(List<String> wanPortIds) {
    this.wanPortIds = wanPortIds;
    return this;
  }

  public BandwidthControlRule addWanPortIdsItem(String wanPortIdsItem) {
    this.wanPortIds.add(wanPortIdsItem);
    return this;
  }

  /**
   * WAN port IDs of the bandwidth control rule.WAN port ID can be obtained from 'Get internet basic info' interface.
   * @return wanPortIds
  */
  @ApiModelProperty(required = true, value = "WAN port IDs of the bandwidth control rule.WAN port ID can be obtained from 'Get internet basic info' interface.")
  @NotNull


  public List<String> getWanPortIds() {
    return wanPortIds;
  }

  public void setWanPortIds(List<String> wanPortIds) {
    this.wanPortIds = wanPortIds;
  }

  public BandwidthControlRule upstreamBandwidth(Integer upstreamBandwidth) {
    this.upstreamBandwidth = upstreamBandwidth;
    return this;
  }

  /**
   * Upstream bandwidth should be within the range of 1–9999999.
   * @return upstreamBandwidth
  */
  @ApiModelProperty(required = true, value = "Upstream bandwidth should be within the range of 1–9999999.")
  @NotNull


  public Integer getUpstreamBandwidth() {
    return upstreamBandwidth;
  }

  public void setUpstreamBandwidth(Integer upstreamBandwidth) {
    this.upstreamBandwidth = upstreamBandwidth;
  }

  public BandwidthControlRule upstreamBandwidthUnit(Integer upstreamBandwidthUnit) {
    this.upstreamBandwidthUnit = upstreamBandwidthUnit;
    return this;
  }

  /**
   * Upstream bandwidth unit should be a value as follows: 1: Kbps, 2: Mbps.
   * @return upstreamBandwidthUnit
  */
  @ApiModelProperty(required = true, value = "Upstream bandwidth unit should be a value as follows: 1: Kbps, 2: Mbps.")
  @NotNull


  public Integer getUpstreamBandwidthUnit() {
    return upstreamBandwidthUnit;
  }

  public void setUpstreamBandwidthUnit(Integer upstreamBandwidthUnit) {
    this.upstreamBandwidthUnit = upstreamBandwidthUnit;
  }

  public BandwidthControlRule downstreamBandwidth(Integer downstreamBandwidth) {
    this.downstreamBandwidth = downstreamBandwidth;
    return this;
  }

  /**
   * Downstream bandwidth should be within the range of 1–9999999.
   * @return downstreamBandwidth
  */
  @ApiModelProperty(required = true, value = "Downstream bandwidth should be within the range of 1–9999999.")
  @NotNull


  public Integer getDownstreamBandwidth() {
    return downstreamBandwidth;
  }

  public void setDownstreamBandwidth(Integer downstreamBandwidth) {
    this.downstreamBandwidth = downstreamBandwidth;
  }

  public BandwidthControlRule downstreamBandwidthUnit(Integer downstreamBandwidthUnit) {
    this.downstreamBandwidthUnit = downstreamBandwidthUnit;
    return this;
  }

  /**
   * Downstream bandwidth unit should be a value as follows: 1: Kbps, 2: Mbps.
   * @return downstreamBandwidthUnit
  */
  @ApiModelProperty(required = true, value = "Downstream bandwidth unit should be a value as follows: 1: Kbps, 2: Mbps.")
  @NotNull


  public Integer getDownstreamBandwidthUnit() {
    return downstreamBandwidthUnit;
  }

  public void setDownstreamBandwidthUnit(Integer downstreamBandwidthUnit) {
    this.downstreamBandwidthUnit = downstreamBandwidthUnit;
  }

  public BandwidthControlRule mode(Integer mode) {
    this.mode = mode;
    return this;
  }

  /**
   * Mode should be a value as follows: 0: share; 1: individual.
   * @return mode
  */
  @ApiModelProperty(required = true, value = "Mode should be a value as follows: 0: share; 1: individual.")
  @NotNull


  public Integer getMode() {
    return mode;
  }

  public void setMode(Integer mode) {
    this.mode = mode;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    BandwidthControlRule bandwidthControlRule = (BandwidthControlRule) o;
    return Objects.equals(this.id, bandwidthControlRule.id) &&
        Objects.equals(this.name, bandwidthControlRule.name) &&
        Objects.equals(this.index, bandwidthControlRule.index) &&
        Objects.equals(this.status, bandwidthControlRule.status) &&
        Objects.equals(this.sourceType, bandwidthControlRule.sourceType) &&
        Objects.equals(this.sourceIds, bandwidthControlRule.sourceIds) &&
        Objects.equals(this.wanPortIds, bandwidthControlRule.wanPortIds) &&
        Objects.equals(this.upstreamBandwidth, bandwidthControlRule.upstreamBandwidth) &&
        Objects.equals(this.upstreamBandwidthUnit, bandwidthControlRule.upstreamBandwidthUnit) &&
        Objects.equals(this.downstreamBandwidth, bandwidthControlRule.downstreamBandwidth) &&
        Objects.equals(this.downstreamBandwidthUnit, bandwidthControlRule.downstreamBandwidthUnit) &&
        Objects.equals(this.mode, bandwidthControlRule.mode);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, name, index, status, sourceType, sourceIds, wanPortIds, upstreamBandwidth, upstreamBandwidthUnit, downstreamBandwidth, downstreamBandwidthUnit, mode);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class BandwidthControlRule {\n");
    
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    index: ").append(toIndentedString(index)).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("    wanPortIds: ").append(toIndentedString(wanPortIds)).append("\n");
    sb.append("    upstreamBandwidth: ").append(toIndentedString(upstreamBandwidth)).append("\n");
    sb.append("    upstreamBandwidthUnit: ").append(toIndentedString(upstreamBandwidthUnit)).append("\n");
    sb.append("    downstreamBandwidth: ").append(toIndentedString(downstreamBandwidth)).append("\n");
    sb.append("    downstreamBandwidthUnit: ").append(toIndentedString(downstreamBandwidthUnit)).append("\n");
    sb.append("    mode: ").append(toIndentedString(mode)).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    ");
  }
}

