All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fireblocks.sdk.model.SmartTransferTicket Maven / Gradle / Ivy

/*
 * Fireblocks API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.6.2
 * Contact: [email protected]
 *
 * 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.fireblocks.sdk.model;


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonValue;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

/** Data object with result data */
@JsonPropertyOrder({
    SmartTransferTicket.JSON_PROPERTY_ID,
    SmartTransferTicket.JSON_PROPERTY_TYPE,
    SmartTransferTicket.JSON_PROPERTY_DIRECTION,
    SmartTransferTicket.JSON_PROPERTY_STATUS,
    SmartTransferTicket.JSON_PROPERTY_TERMS,
    SmartTransferTicket.JSON_PROPERTY_EXPIRES_IN,
    SmartTransferTicket.JSON_PROPERTY_EXPIRES_AT,
    SmartTransferTicket.JSON_PROPERTY_SUBMITTED_AT,
    SmartTransferTicket.JSON_PROPERTY_EXPIRED_AT,
    SmartTransferTicket.JSON_PROPERTY_CANCELED_AT,
    SmartTransferTicket.JSON_PROPERTY_FULFILLED_AT,
    SmartTransferTicket.JSON_PROPERTY_EXTERNAL_REF_ID,
    SmartTransferTicket.JSON_PROPERTY_NOTE,
    SmartTransferTicket.JSON_PROPERTY_CREATED_BY_NETWORK_ID,
    SmartTransferTicket.JSON_PROPERTY_CREATED_BY_NETWORK_ID_NAME,
    SmartTransferTicket.JSON_PROPERTY_CANCELED_BY_NETWORK_ID_NAME,
    SmartTransferTicket.JSON_PROPERTY_CREATED_AT,
    SmartTransferTicket.JSON_PROPERTY_UPDATED_AT,
    SmartTransferTicket.JSON_PROPERTY_CANCELED_BY_ME,
    SmartTransferTicket.JSON_PROPERTY_CREATED_BY_ME
})
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class SmartTransferTicket {
    public static final String JSON_PROPERTY_ID = "id";
    private String id;

    /** Kind of Smart Transfer. Can be either `ASYNC` or `ATOMIC` */
    public enum TypeEnum {
        ASYNC("ASYNC");

        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;

    /** Direction of Smart Transfer. */
    public enum DirectionEnum {
        EXCHANGE("EXCHANGE"),

        SEND("SEND"),

        RECEIVE("RECEIVE"),

        INTERMEDIATE("INTERMEDIATE");

        private String value;

        DirectionEnum(String value) {
            this.value = value;
        }

        @JsonValue
        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return String.valueOf(value);
        }

        @JsonCreator
        public static DirectionEnum fromValue(String value) {
            for (DirectionEnum b : DirectionEnum.values()) {
                if (b.value.equals(value)) {
                    return b;
                }
            }
            throw new IllegalArgumentException("Unexpected value '" + value + "'");
        }
    }

    public static final String JSON_PROPERTY_DIRECTION = "direction";
    private DirectionEnum direction;

    /** Current status of Smart Transfer ticket */
    public enum StatusEnum {
        DRAFT("DRAFT"),

        PENDING_APPROVAL("PENDING_APPROVAL"),

        OPEN("OPEN"),

        IN_SETTLEMENT("IN_SETTLEMENT"),

        FULFILLED("FULFILLED"),

        EXPIRED("EXPIRED"),

        CANCELED("CANCELED");

        private String value;

        StatusEnum(String value) {
            this.value = value;
        }

        @JsonValue
        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return String.valueOf(value);
        }

        @JsonCreator
        public static StatusEnum fromValue(String value) {
            for (StatusEnum b : StatusEnum.values()) {
                if (b.value.equals(value)) {
                    return b;
                }
            }
            throw new IllegalArgumentException("Unexpected value '" + value + "'");
        }
    }

    public static final String JSON_PROPERTY_STATUS = "status";
    private StatusEnum status;

    public static final String JSON_PROPERTY_TERMS = "terms";
    private List terms;

    public static final String JSON_PROPERTY_EXPIRES_IN = "expiresIn";
    private BigDecimal expiresIn;

    public static final String JSON_PROPERTY_EXPIRES_AT = "expiresAt";
    private OffsetDateTime expiresAt;

    public static final String JSON_PROPERTY_SUBMITTED_AT = "submittedAt";
    private OffsetDateTime submittedAt;

    public static final String JSON_PROPERTY_EXPIRED_AT = "expiredAt";
    private OffsetDateTime expiredAt;

    public static final String JSON_PROPERTY_CANCELED_AT = "canceledAt";
    private OffsetDateTime canceledAt;

    public static final String JSON_PROPERTY_FULFILLED_AT = "fulfilledAt";
    private OffsetDateTime fulfilledAt;

    public static final String JSON_PROPERTY_EXTERNAL_REF_ID = "externalRefId";
    private String externalRefId;

    public static final String JSON_PROPERTY_NOTE = "note";
    private String note;

    public static final String JSON_PROPERTY_CREATED_BY_NETWORK_ID = "createdByNetworkId";
    private String createdByNetworkId;

    public static final String JSON_PROPERTY_CREATED_BY_NETWORK_ID_NAME = "createdByNetworkIdName";
    private String createdByNetworkIdName;

    public static final String JSON_PROPERTY_CANCELED_BY_NETWORK_ID_NAME =
            "canceledByNetworkIdName";
    private String canceledByNetworkIdName;

    public static final String JSON_PROPERTY_CREATED_AT = "createdAt";
    private OffsetDateTime createdAt;

    public static final String JSON_PROPERTY_UPDATED_AT = "updatedAt";
    private OffsetDateTime updatedAt;

    public static final String JSON_PROPERTY_CANCELED_BY_ME = "canceledByMe";
    private Boolean canceledByMe;

    public static final String JSON_PROPERTY_CREATED_BY_ME = "createdByMe";
    private Boolean createdByMe;

    public SmartTransferTicket() {}

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

    /**
     * Unique id of Smart Transfer ticket
     *
     * @return id
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public String getId() {
        return id;
    }

    @JsonProperty(JSON_PROPERTY_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setId(String id) {
        this.id = id;
    }

    public SmartTransferTicket type(TypeEnum type) {
        this.type = type;
        return this;
    }

    /**
     * Kind of Smart Transfer. Can be either `ASYNC` or `ATOMIC`
     *
     * @return type
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public TypeEnum getType() {
        return type;
    }

    @JsonProperty(JSON_PROPERTY_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setType(TypeEnum type) {
        this.type = type;
    }

    public SmartTransferTicket direction(DirectionEnum direction) {
        this.direction = direction;
        return this;
    }

    /**
     * Direction of Smart Transfer.
     *
     * @return direction
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_DIRECTION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public DirectionEnum getDirection() {
        return direction;
    }

    @JsonProperty(JSON_PROPERTY_DIRECTION)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setDirection(DirectionEnum direction) {
        this.direction = direction;
    }

    public SmartTransferTicket status(StatusEnum status) {
        this.status = status;
        return this;
    }

    /**
     * Current status of Smart Transfer ticket
     *
     * @return status
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_STATUS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public StatusEnum getStatus() {
        return status;
    }

    @JsonProperty(JSON_PROPERTY_STATUS)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setStatus(StatusEnum status) {
        this.status = status;
    }

    public SmartTransferTicket terms(List terms) {
        this.terms = terms;
        return this;
    }

    public SmartTransferTicket addTermsItem(SmartTransferTicketTerm termsItem) {
        if (this.terms == null) {
            this.terms = new ArrayList<>();
        }
        this.terms.add(termsItem);
        return this;
    }

    /**
     * Ticket terms (legs)
     *
     * @return terms
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_TERMS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public List getTerms() {
        return terms;
    }

    @JsonProperty(JSON_PROPERTY_TERMS)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setTerms(List terms) {
        this.terms = terms;
    }

    public SmartTransferTicket expiresIn(BigDecimal expiresIn) {
        this.expiresIn = expiresIn;
        return this;
    }

    /**
     * Number of hours for expiration.This data is valid only it ticket not in DRAFT state and it
     * will be used to calculate expiresAt value
     *
     * @return expiresIn
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_EXPIRES_IN)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public BigDecimal getExpiresIn() {
        return expiresIn;
    }

    @JsonProperty(JSON_PROPERTY_EXPIRES_IN)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setExpiresIn(BigDecimal expiresIn) {
        this.expiresIn = expiresIn;
    }

    public SmartTransferTicket expiresAt(OffsetDateTime expiresAt) {
        this.expiresAt = expiresAt;
        return this;
    }

    /**
     * Date and time at which the ticket will expire if no funding is performed.
     *
     * @return expiresAt
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_EXPIRES_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public OffsetDateTime getExpiresAt() {
        return expiresAt;
    }

    @JsonProperty(JSON_PROPERTY_EXPIRES_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setExpiresAt(OffsetDateTime expiresAt) {
        this.expiresAt = expiresAt;
    }

    public SmartTransferTicket submittedAt(OffsetDateTime submittedAt) {
        this.submittedAt = submittedAt;
        return this;
    }

    /**
     * Date and time when ticket is submitted.
     *
     * @return submittedAt
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_SUBMITTED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public OffsetDateTime getSubmittedAt() {
        return submittedAt;
    }

    @JsonProperty(JSON_PROPERTY_SUBMITTED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setSubmittedAt(OffsetDateTime submittedAt) {
        this.submittedAt = submittedAt;
    }

    public SmartTransferTicket expiredAt(OffsetDateTime expiredAt) {
        this.expiredAt = expiredAt;
        return this;
    }

    /**
     * Date and time when ticket is expired.
     *
     * @return expiredAt
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_EXPIRED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public OffsetDateTime getExpiredAt() {
        return expiredAt;
    }

    @JsonProperty(JSON_PROPERTY_EXPIRED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setExpiredAt(OffsetDateTime expiredAt) {
        this.expiredAt = expiredAt;
    }

    public SmartTransferTicket canceledAt(OffsetDateTime canceledAt) {
        this.canceledAt = canceledAt;
        return this;
    }

    /**
     * Date and time when ticket is canceled.
     *
     * @return canceledAt
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CANCELED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public OffsetDateTime getCanceledAt() {
        return canceledAt;
    }

    @JsonProperty(JSON_PROPERTY_CANCELED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCanceledAt(OffsetDateTime canceledAt) {
        this.canceledAt = canceledAt;
    }

    public SmartTransferTicket fulfilledAt(OffsetDateTime fulfilledAt) {
        this.fulfilledAt = fulfilledAt;
        return this;
    }

    /**
     * Date and time when ticket is fulfilled.
     *
     * @return fulfilledAt
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_FULFILLED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public OffsetDateTime getFulfilledAt() {
        return fulfilledAt;
    }

    @JsonProperty(JSON_PROPERTY_FULFILLED_AT)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setFulfilledAt(OffsetDateTime fulfilledAt) {
        this.fulfilledAt = fulfilledAt;
    }

    public SmartTransferTicket externalRefId(String externalRefId) {
        this.externalRefId = externalRefId;
        return this;
    }

    /**
     * External Ref ID for Smart Transfer ticket.
     *
     * @return externalRefId
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_EXTERNAL_REF_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getExternalRefId() {
        return externalRefId;
    }

    @JsonProperty(JSON_PROPERTY_EXTERNAL_REF_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setExternalRefId(String externalRefId) {
        this.externalRefId = externalRefId;
    }

    public SmartTransferTicket note(String note) {
        this.note = note;
        return this;
    }

    /**
     * Note
     *
     * @return note
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_NOTE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getNote() {
        return note;
    }

    @JsonProperty(JSON_PROPERTY_NOTE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setNote(String note) {
        this.note = note;
    }

    public SmartTransferTicket createdByNetworkId(String createdByNetworkId) {
        this.createdByNetworkId = createdByNetworkId;
        return this;
    }

    /**
     * ID of network profile that created ticket
     *
     * @return createdByNetworkId
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_CREATED_BY_NETWORK_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public String getCreatedByNetworkId() {
        return createdByNetworkId;
    }

    @JsonProperty(JSON_PROPERTY_CREATED_BY_NETWORK_ID)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setCreatedByNetworkId(String createdByNetworkId) {
        this.createdByNetworkId = createdByNetworkId;
    }

    public SmartTransferTicket createdByNetworkIdName(String createdByNetworkIdName) {
        this.createdByNetworkIdName = createdByNetworkIdName;
        return this;
    }

    /**
     * Name of network profile that created ticket
     *
     * @return createdByNetworkIdName
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_CREATED_BY_NETWORK_ID_NAME)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public String getCreatedByNetworkIdName() {
        return createdByNetworkIdName;
    }

    @JsonProperty(JSON_PROPERTY_CREATED_BY_NETWORK_ID_NAME)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setCreatedByNetworkIdName(String createdByNetworkIdName) {
        this.createdByNetworkIdName = createdByNetworkIdName;
    }

    public SmartTransferTicket canceledByNetworkIdName(String canceledByNetworkIdName) {
        this.canceledByNetworkIdName = canceledByNetworkIdName;
        return this;
    }

    /**
     * Name of network profile that canceled ticket
     *
     * @return canceledByNetworkIdName
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CANCELED_BY_NETWORK_ID_NAME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public String getCanceledByNetworkIdName() {
        return canceledByNetworkIdName;
    }

    @JsonProperty(JSON_PROPERTY_CANCELED_BY_NETWORK_ID_NAME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCanceledByNetworkIdName(String canceledByNetworkIdName) {
        this.canceledByNetworkIdName = canceledByNetworkIdName;
    }

    public SmartTransferTicket createdAt(OffsetDateTime createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    /**
     * Date and time at which the ticket is created.
     *
     * @return createdAt
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_CREATED_AT)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public OffsetDateTime getCreatedAt() {
        return createdAt;
    }

    @JsonProperty(JSON_PROPERTY_CREATED_AT)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setCreatedAt(OffsetDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public SmartTransferTicket updatedAt(OffsetDateTime updatedAt) {
        this.updatedAt = updatedAt;
        return this;
    }

    /**
     * Date and time of last ticket update.
     *
     * @return updatedAt
     */
    @jakarta.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_UPDATED_AT)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public OffsetDateTime getUpdatedAt() {
        return updatedAt;
    }

    @JsonProperty(JSON_PROPERTY_UPDATED_AT)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setUpdatedAt(OffsetDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    public SmartTransferTicket canceledByMe(Boolean canceledByMe) {
        this.canceledByMe = canceledByMe;
        return this;
    }

    /**
     * Get canceledByMe
     *
     * @return canceledByMe
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CANCELED_BY_ME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public Boolean getCanceledByMe() {
        return canceledByMe;
    }

    @JsonProperty(JSON_PROPERTY_CANCELED_BY_ME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCanceledByMe(Boolean canceledByMe) {
        this.canceledByMe = canceledByMe;
    }

    public SmartTransferTicket createdByMe(Boolean createdByMe) {
        this.createdByMe = createdByMe;
        return this;
    }

    /**
     * Get createdByMe
     *
     * @return createdByMe
     */
    @jakarta.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CREATED_BY_ME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public Boolean getCreatedByMe() {
        return createdByMe;
    }

    @JsonProperty(JSON_PROPERTY_CREATED_BY_ME)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCreatedByMe(Boolean createdByMe) {
        this.createdByMe = createdByMe;
    }

    /** Return true if this SmartTransferTicket object is equal to o. */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SmartTransferTicket smartTransferTicket = (SmartTransferTicket) o;
        return Objects.equals(this.id, smartTransferTicket.id)
                && Objects.equals(this.type, smartTransferTicket.type)
                && Objects.equals(this.direction, smartTransferTicket.direction)
                && Objects.equals(this.status, smartTransferTicket.status)
                && Objects.equals(this.terms, smartTransferTicket.terms)
                && Objects.equals(this.expiresIn, smartTransferTicket.expiresIn)
                && Objects.equals(this.expiresAt, smartTransferTicket.expiresAt)
                && Objects.equals(this.submittedAt, smartTransferTicket.submittedAt)
                && Objects.equals(this.expiredAt, smartTransferTicket.expiredAt)
                && Objects.equals(this.canceledAt, smartTransferTicket.canceledAt)
                && Objects.equals(this.fulfilledAt, smartTransferTicket.fulfilledAt)
                && Objects.equals(this.externalRefId, smartTransferTicket.externalRefId)
                && Objects.equals(this.note, smartTransferTicket.note)
                && Objects.equals(this.createdByNetworkId, smartTransferTicket.createdByNetworkId)
                && Objects.equals(
                        this.createdByNetworkIdName, smartTransferTicket.createdByNetworkIdName)
                && Objects.equals(
                        this.canceledByNetworkIdName, smartTransferTicket.canceledByNetworkIdName)
                && Objects.equals(this.createdAt, smartTransferTicket.createdAt)
                && Objects.equals(this.updatedAt, smartTransferTicket.updatedAt)
                && Objects.equals(this.canceledByMe, smartTransferTicket.canceledByMe)
                && Objects.equals(this.createdByMe, smartTransferTicket.createdByMe);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                id,
                type,
                direction,
                status,
                terms,
                expiresIn,
                expiresAt,
                submittedAt,
                expiredAt,
                canceledAt,
                fulfilledAt,
                externalRefId,
                note,
                createdByNetworkId,
                createdByNetworkIdName,
                canceledByNetworkIdName,
                createdAt,
                updatedAt,
                canceledByMe,
                createdByMe);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class SmartTransferTicket {\n");
        sb.append("    id: ").append(toIndentedString(id)).append("\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    direction: ").append(toIndentedString(direction)).append("\n");
        sb.append("    status: ").append(toIndentedString(status)).append("\n");
        sb.append("    terms: ").append(toIndentedString(terms)).append("\n");
        sb.append("    expiresIn: ").append(toIndentedString(expiresIn)).append("\n");
        sb.append("    expiresAt: ").append(toIndentedString(expiresAt)).append("\n");
        sb.append("    submittedAt: ").append(toIndentedString(submittedAt)).append("\n");
        sb.append("    expiredAt: ").append(toIndentedString(expiredAt)).append("\n");
        sb.append("    canceledAt: ").append(toIndentedString(canceledAt)).append("\n");
        sb.append("    fulfilledAt: ").append(toIndentedString(fulfilledAt)).append("\n");
        sb.append("    externalRefId: ").append(toIndentedString(externalRefId)).append("\n");
        sb.append("    note: ").append(toIndentedString(note)).append("\n");
        sb.append("    createdByNetworkId: ")
                .append(toIndentedString(createdByNetworkId))
                .append("\n");
        sb.append("    createdByNetworkIdName: ")
                .append(toIndentedString(createdByNetworkIdName))
                .append("\n");
        sb.append("    canceledByNetworkIdName: ")
                .append(toIndentedString(canceledByNetworkIdName))
                .append("\n");
        sb.append("    createdAt: ").append(toIndentedString(createdAt)).append("\n");
        sb.append("    updatedAt: ").append(toIndentedString(updatedAt)).append("\n");
        sb.append("    canceledByMe: ").append(toIndentedString(canceledByMe)).append("\n");
        sb.append("    createdByMe: ").append(toIndentedString(createdByMe)).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    ");
    }

    /**
     * Convert the instance into URL query string.
     *
     * @return URL query string
     */
    public String toUrlQueryString() {
        return toUrlQueryString(null);
    }

    /**
     * Convert the instance into URL query string.
     *
     * @param prefix prefix of the query string
     * @return URL query string
     */
    public String toUrlQueryString(String prefix) {
        String suffix = "";
        String containerSuffix = "";
        String containerPrefix = "";
        if (prefix == null) {
            // style=form, explode=true, e.g. /pet?name=cat&type=manx
            prefix = "";
        } else {
            // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
            prefix = prefix + "[";
            suffix = "]";
            containerSuffix = "]";
            containerPrefix = "[";
        }

        StringJoiner joiner = new StringJoiner("&");

        // add `id` to the URL query string
        if (getId() != null) {
            joiner.add(
                    String.format(
                            "%sid%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `type` to the URL query string
        if (getType() != null) {
            joiner.add(
                    String.format(
                            "%stype%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `direction` to the URL query string
        if (getDirection() != null) {
            joiner.add(
                    String.format(
                            "%sdirection%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getDirection()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `status` to the URL query string
        if (getStatus() != null) {
            joiner.add(
                    String.format(
                            "%sstatus%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(String.valueOf(getStatus()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `terms` to the URL query string
        if (getTerms() != null) {
            for (int i = 0; i < getTerms().size(); i++) {
                if (getTerms().get(i) != null) {
                    joiner.add(
                            getTerms()
                                    .get(i)
                                    .toUrlQueryString(
                                            String.format(
                                                    "%sterms%s%s",
                                                    prefix,
                                                    suffix,
                                                    "".equals(suffix)
                                                            ? ""
                                                            : String.format(
                                                                    "%s%d%s",
                                                                    containerPrefix,
                                                                    i,
                                                                    containerSuffix))));
                }
            }
        }

        // add `expiresIn` to the URL query string
        if (getExpiresIn() != null) {
            joiner.add(
                    String.format(
                            "%sexpiresIn%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getExpiresIn()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `expiresAt` to the URL query string
        if (getExpiresAt() != null) {
            joiner.add(
                    String.format(
                            "%sexpiresAt%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getExpiresAt()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `submittedAt` to the URL query string
        if (getSubmittedAt() != null) {
            joiner.add(
                    String.format(
                            "%ssubmittedAt%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getSubmittedAt()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `expiredAt` to the URL query string
        if (getExpiredAt() != null) {
            joiner.add(
                    String.format(
                            "%sexpiredAt%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getExpiredAt()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `canceledAt` to the URL query string
        if (getCanceledAt() != null) {
            joiner.add(
                    String.format(
                            "%scanceledAt%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getCanceledAt()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `fulfilledAt` to the URL query string
        if (getFulfilledAt() != null) {
            joiner.add(
                    String.format(
                            "%sfulfilledAt%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getFulfilledAt()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `externalRefId` to the URL query string
        if (getExternalRefId() != null) {
            joiner.add(
                    String.format(
                            "%sexternalRefId%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getExternalRefId()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `note` to the URL query string
        if (getNote() != null) {
            joiner.add(
                    String.format(
                            "%snote%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(String.valueOf(getNote()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `createdByNetworkId` to the URL query string
        if (getCreatedByNetworkId() != null) {
            joiner.add(
                    String.format(
                            "%screatedByNetworkId%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getCreatedByNetworkId()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `createdByNetworkIdName` to the URL query string
        if (getCreatedByNetworkIdName() != null) {
            joiner.add(
                    String.format(
                            "%screatedByNetworkIdName%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getCreatedByNetworkIdName()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `canceledByNetworkIdName` to the URL query string
        if (getCanceledByNetworkIdName() != null) {
            joiner.add(
                    String.format(
                            "%scanceledByNetworkIdName%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getCanceledByNetworkIdName()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `createdAt` to the URL query string
        if (getCreatedAt() != null) {
            joiner.add(
                    String.format(
                            "%screatedAt%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getCreatedAt()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `updatedAt` to the URL query string
        if (getUpdatedAt() != null) {
            joiner.add(
                    String.format(
                            "%supdatedAt%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getUpdatedAt()), StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `canceledByMe` to the URL query string
        if (getCanceledByMe() != null) {
            joiner.add(
                    String.format(
                            "%scanceledByMe%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getCanceledByMe()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        // add `createdByMe` to the URL query string
        if (getCreatedByMe() != null) {
            joiner.add(
                    String.format(
                            "%screatedByMe%s=%s",
                            prefix,
                            suffix,
                            URLEncoder.encode(
                                            String.valueOf(getCreatedByMe()),
                                            StandardCharsets.UTF_8)
                                    .replaceAll("\\+", "%20")));
        }

        return joiner.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy