com.huaweicloud.sdk.gaussdbforopengauss.v3.model.OpenGaussChargeInfo Maven / Gradle / Ivy
package com.huaweicloud.sdk.gaussdbforopengauss.v3.model;
import java.util.Collections;
import java.util.Collections;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import java.util.Objects;
/**
* 计费类型信息,仅支持按需和包周期。
*/
public class OpenGaussChargeInfo {
/**
* 计费模式。postPaid:后付费,即按需付费。prePaid:预付费,即包年/包月。
*/
public static final class ChargeModeEnum {
/**
* Enum POSTPAID for value: "postPaid"
*/
public static final ChargeModeEnum POSTPAID = new ChargeModeEnum("postPaid");
/**
* Enum PREPAID for value: "prePaid"
*/
public static final ChargeModeEnum PREPAID = new ChargeModeEnum("prePaid");
private static final Map STATIC_FIELDS = createStaticFields();
private static Map createStaticFields() {
Map map = new HashMap<>();
map.put("postPaid", POSTPAID);
map.put("prePaid", PREPAID);
return Collections.unmodifiableMap(map);
}
private String value;
ChargeModeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ChargeModeEnum fromValue(String value) {
if( value == null ){
return null;
}
ChargeModeEnum result = STATIC_FIELDS.get(value);
if (result == null) {
result = new ChargeModeEnum(value);
}
return result;
}
public static ChargeModeEnum valueOf(String value) {
if( value == null ){
return null;
}
ChargeModeEnum result = STATIC_FIELDS.get(value);
if (result != null) {
return result;
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ChargeModeEnum) {
return this.value.equals(((ChargeModeEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="charge_mode")
private ChargeModeEnum chargeMode;
/**
* 订购周期类型。month:包月。year:包年。 说明: “charge_mode”为“prePaid”时生效,且为必选值。
*/
public static final class PeriodTypeEnum {
/**
* Enum MONTH for value: "month"
*/
public static final PeriodTypeEnum MONTH = new PeriodTypeEnum("month");
/**
* Enum YEAR for value: "year"
*/
public static final PeriodTypeEnum YEAR = new PeriodTypeEnum("year");
private static final Map STATIC_FIELDS = createStaticFields();
private static Map createStaticFields() {
Map map = new HashMap<>();
map.put("month", MONTH);
map.put("year", YEAR);
return Collections.unmodifiableMap(map);
}
private String value;
PeriodTypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static PeriodTypeEnum fromValue(String value) {
if( value == null ){
return null;
}
PeriodTypeEnum result = STATIC_FIELDS.get(value);
if (result == null) {
result = new PeriodTypeEnum(value);
}
return result;
}
public static PeriodTypeEnum valueOf(String value) {
if( value == null ){
return null;
}
PeriodTypeEnum result = STATIC_FIELDS.get(value);
if (result != null) {
return result;
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@Override
public boolean equals(Object obj) {
if (obj instanceof PeriodTypeEnum) {
return this.value.equals(((PeriodTypeEnum) obj).value);
}
return false;
}
@Override
public int hashCode() {
return this.value.hashCode();
}
}
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="period_type")
private PeriodTypeEnum periodType;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="period_num")
private Integer periodNum;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="is_auto_renew")
private Boolean isAutoRenew;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="is_auto_pay")
private Boolean isAutoPay;
public OpenGaussChargeInfo withChargeMode(ChargeModeEnum chargeMode) {
this.chargeMode = chargeMode;
return this;
}
/**
* 计费模式。postPaid:后付费,即按需付费。prePaid:预付费,即包年/包月。
* @return chargeMode
*/
public ChargeModeEnum getChargeMode() {
return chargeMode;
}
public void setChargeMode(ChargeModeEnum chargeMode) {
this.chargeMode = chargeMode;
}
public OpenGaussChargeInfo withPeriodType(PeriodTypeEnum periodType) {
this.periodType = periodType;
return this;
}
/**
* 订购周期类型。month:包月。year:包年。 说明: “charge_mode”为“prePaid”时生效,且为必选值。
* @return periodType
*/
public PeriodTypeEnum getPeriodType() {
return periodType;
}
public void setPeriodType(PeriodTypeEnum periodType) {
this.periodType = periodType;
}
public OpenGaussChargeInfo withPeriodNum(Integer periodNum) {
this.periodNum = periodNum;
return this;
}
/**
* “charge_mode”为“prePaid”时生效,且为必选值,指定订购的时间。 取值范围: 当“period_type”为“month”时,取值为1~9。 当“period_type”为“year”时,取值为1~3。 当传入浮点型时,会自动截取为整型。
* @return periodNum
*/
public Integer getPeriodNum() {
return periodNum;
}
public void setPeriodNum(Integer periodNum) {
this.periodNum = periodNum;
}
public OpenGaussChargeInfo withIsAutoRenew(Boolean isAutoRenew) {
this.isAutoRenew = isAutoRenew;
return this;
}
/**
* 创建包周期实例时可指定,表示是否自动续订,续订时会自动支付。 按月订购时续订周期默认为1个月,按年订购时续订周期默认为1年,续订周期可自定义修改。 true,表示自动续订。 false,表示不自动续订,默认为该方式。
* @return isAutoRenew
*/
public Boolean getIsAutoRenew() {
return isAutoRenew;
}
public void setIsAutoRenew(Boolean isAutoRenew) {
this.isAutoRenew = isAutoRenew;
}
public OpenGaussChargeInfo withIsAutoPay(Boolean isAutoPay) {
this.isAutoPay = isAutoPay;
return this;
}
/**
* 创建包周期实例时可指定,表示是否自动从账户中支付,该字段不影响自动续订的支付方式。 true,表示自动从账户中支付。 false,表示手动从账户中支付,默认为该支付方式。
* @return isAutoPay
*/
public Boolean getIsAutoPay() {
return isAutoPay;
}
public void setIsAutoPay(Boolean isAutoPay) {
this.isAutoPay = isAutoPay;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OpenGaussChargeInfo openGaussChargeInfo = (OpenGaussChargeInfo) o;
return Objects.equals(this.chargeMode, openGaussChargeInfo.chargeMode) &&
Objects.equals(this.periodType, openGaussChargeInfo.periodType) &&
Objects.equals(this.periodNum, openGaussChargeInfo.periodNum) &&
Objects.equals(this.isAutoRenew, openGaussChargeInfo.isAutoRenew) &&
Objects.equals(this.isAutoPay, openGaussChargeInfo.isAutoPay);
}
@Override
public int hashCode() {
return Objects.hash(chargeMode, periodType, periodNum, isAutoRenew, isAutoPay);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class OpenGaussChargeInfo {\n");
sb.append(" chargeMode: ").append(toIndentedString(chargeMode)).append("\n");
sb.append(" periodType: ").append(toIndentedString(periodType)).append("\n");
sb.append(" periodNum: ").append(toIndentedString(periodNum)).append("\n");
sb.append(" isAutoRenew: ").append(toIndentedString(isAutoRenew)).append("\n");
sb.append(" isAutoPay: ").append(toIndentedString(isAutoPay)).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(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}