com.adyen.model.configurationwebhooks.Phone Maven / Gradle / Ivy
/*
* Configuration webhooks
*
* The version of the OpenAPI document: 2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.adyen.model.configurationwebhooks;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.core.JsonProcessingException;
/**
* Phone
*/
@JsonPropertyOrder({
Phone.JSON_PROPERTY_NUMBER,
Phone.JSON_PROPERTY_TYPE
})
public class Phone {
public static final String JSON_PROPERTY_NUMBER = "number";
private String number;
/**
* Type of phone number. Possible values: **Landline**, **Mobile**.
*/
public enum TypeEnum {
LANDLINE("landline"),
MOBILE("mobile");
private String value;
TypeEnum(String value) {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static TypeEnum fromValue(String value) {
for (TypeEnum b : TypeEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
public static final String JSON_PROPERTY_TYPE = "type";
private TypeEnum type;
public Phone() {
}
public Phone number(String number) {
this.number = number;
return this;
}
/**
* The full phone number provided as a single string. For example, **\"0031 6 11 22 33 44\"**, **\"+316/1122-3344\"**, or **\"(0031) 611223344\"**.
* @return number
**/
@ApiModelProperty(required = true, value = "The full phone number provided as a single string. For example, **\"0031 6 11 22 33 44\"**, **\"+316/1122-3344\"**, or **\"(0031) 611223344\"**.")
@JsonProperty(JSON_PROPERTY_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getNumber() {
return number;
}
/**
* The full phone number provided as a single string. For example, **\"0031 6 11 22 33 44\"**, **\"+316/1122-3344\"**, or **\"(0031) 611223344\"**.
*
* @param number
*/
@JsonProperty(JSON_PROPERTY_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setNumber(String number) {
this.number = number;
}
public Phone type(TypeEnum type) {
this.type = type;
return this;
}
/**
* Type of phone number. Possible values: **Landline**, **Mobile**.
* @return type
**/
@ApiModelProperty(required = true, value = "Type of phone number. Possible values: **Landline**, **Mobile**. ")
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public TypeEnum getType() {
return type;
}
/**
* Type of phone number. Possible values: **Landline**, **Mobile**.
*
* @param type
*/
@JsonProperty(JSON_PROPERTY_TYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setType(TypeEnum type) {
this.type = type;
}
/**
* Return true if this Phone object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Phone phone = (Phone) o;
return Objects.equals(this.number, phone.number) &&
Objects.equals(this.type, phone.type);
}
@Override
public int hashCode() {
return Objects.hash(number, type);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Phone {\n");
sb.append(" number: ").append(toIndentedString(number)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).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 ");
}
/**
* Create an instance of Phone given an JSON string
*
* @param jsonString JSON string
* @return An instance of Phone
* @throws JsonProcessingException if the JSON string is invalid with respect to Phone
*/
public static Phone fromJson(String jsonString) throws JsonProcessingException {
return JSON.getMapper().readValue(jsonString, Phone.class);
}
/**
* Convert an instance of Phone to an JSON string
*
* @return JSON string
*/
public String toJson() throws JsonProcessingException {
return JSON.getMapper().writeValueAsString(this);
}
}