content: /*
   * Iam
   * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
   *
   * The version of the OpenAPI document: 1.0.0
   * Contact: info@affinidi.com
   *
   * 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.affinidi.tdk.iam.client.models;
  
  import java.util.Objects;
  import java.util.Arrays;
  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 com.fasterxml.jackson.annotation.JsonPropertyOrder;
  import com.fasterxml.jackson.annotation.JsonTypeName;
  import java.io.UnsupportedEncodingException;
  import java.net.URLEncoder;
  import java.util.StringJoiner;
  
  /**
   * ConsumerAuthTokenEndpointInput
   */
  @JsonPropertyOrder({
    ConsumerAuthTokenEndpointInput.JSON_PROPERTY_GRANT_TYPE,
    ConsumerAuthTokenEndpointInput.JSON_PROPERTY_CLIENT_ASSERTION_TYPE,
    ConsumerAuthTokenEndpointInput.JSON_PROPERTY_CLIENT_ASSERTION,
    ConsumerAuthTokenEndpointInput.JSON_PROPERTY_CODE,
    ConsumerAuthTokenEndpointInput.JSON_PROPERTY_REFRESH_TOKEN,
    ConsumerAuthTokenEndpointInput.JSON_PROPERTY_REDIRECT_URI,
    ConsumerAuthTokenEndpointInput.JSON_PROPERTY_CLIENT_ID
  })
  @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.13.0")
  public class ConsumerAuthTokenEndpointInput {
    /**
     * Gets or Sets grantType
     */
    public enum GrantTypeEnum {
      CLIENT_CREDENTIALS(String.valueOf("client_credentials")),
      
      AFFINIDI_DELEGATION(String.valueOf("affinidi_delegation"));
  
      private String value;
  
      GrantTypeEnum(String value) {
        this.value = value;
      }
  
      @JsonValue
      public String getValue() {
        return value;
      }
  
      @Override
      public String toString() {
        return String.valueOf(value);
      }
  
      @JsonCreator
      public static GrantTypeEnum fromValue(String value) {
        for (GrantTypeEnum b : GrantTypeEnum.values()) {
          if (b.value.equals(value)) {
            return b;
          }
        }
        throw new IllegalArgumentException("Unexpected value '" + value + "'");
      }
    }
  
    public static final String JSON_PROPERTY_GRANT_TYPE = "grant_type";
    @javax.annotation.Nonnull
    private GrantTypeEnum grantType;
  
    /**
     * Gets or Sets clientAssertionType
     */
    public enum ClientAssertionTypeEnum {
      URN_IETF_PARAMS_OAUTH_CLIENT_ASSERTION_TYPE_JWT_BEARER(String.valueOf("urn:ietf:params:oauth:client-assertion-type:jwt-bearer")),
      
      URN_IETF_PARAMS_OAUTH_DELEGATION_ASSERTION_TYPE_JWT_BEARER(String.valueOf("urn:ietf:params:oauth:delegation-assertion-type:jwt-bearer"));
  
      private String value;
  
      ClientAssertionTypeEnum(String value) {
        this.value = value;
      }
  
      @JsonValue
      public String getValue() {
        return value;
      }
  
      @Override
      public String toString() {
        return String.valueOf(value);
      }
  
      @JsonCreator
      public static ClientAssertionTypeEnum fromValue(String value) {
        for (ClientAssertionTypeEnum b : ClientAssertionTypeEnum.values()) {
          if (b.value.equals(value)) {
            return b;
          }
        }
        throw new IllegalArgumentException("Unexpected value '" + value + "'");
      }
    }
  
    public static final String JSON_PROPERTY_CLIENT_ASSERTION_TYPE = "client_assertion_type";
    @javax.annotation.Nonnull
    private ClientAssertionTypeEnum clientAssertionType;
  
    public static final String JSON_PROPERTY_CLIENT_ASSERTION = "client_assertion";
    @javax.annotation.Nonnull
    private String clientAssertion;
  
    public static final String JSON_PROPERTY_CODE = "code";
    @javax.annotation.Nullable
    private String code;
  
    public static final String JSON_PROPERTY_REFRESH_TOKEN = "refresh_token";
    @javax.annotation.Nullable
    private String refreshToken;
  
    public static final String JSON_PROPERTY_REDIRECT_URI = "redirect_uri";
    @javax.annotation.Nullable
    private String redirectUri;
  
    public static final String JSON_PROPERTY_CLIENT_ID = "client_id";
    @javax.annotation.Nullable
    private String clientId;
  
    public ConsumerAuthTokenEndpointInput() {
    }
  
    public ConsumerAuthTokenEndpointInput grantType(@javax.annotation.Nonnull GrantTypeEnum grantType) {
      
      this.grantType = grantType;
      return this;
    }
  
    /**
     * Get grantType
     * @return grantType
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_GRANT_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
  
    public GrantTypeEnum getGrantType() {
      return grantType;
    }
  
  
    @JsonProperty(JSON_PROPERTY_GRANT_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setGrantType(@javax.annotation.Nonnull GrantTypeEnum grantType) {
      this.grantType = grantType;
    }
  
    public ConsumerAuthTokenEndpointInput clientAssertionType(@javax.annotation.Nonnull ClientAssertionTypeEnum clientAssertionType) {
      
      this.clientAssertionType = clientAssertionType;
      return this;
    }
  
    /**
     * Get clientAssertionType
     * @return clientAssertionType
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_CLIENT_ASSERTION_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
  
    public ClientAssertionTypeEnum getClientAssertionType() {
      return clientAssertionType;
    }
  
  
    @JsonProperty(JSON_PROPERTY_CLIENT_ASSERTION_TYPE)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setClientAssertionType(@javax.annotation.Nonnull ClientAssertionTypeEnum clientAssertionType) {
      this.clientAssertionType = clientAssertionType;
    }
  
    public ConsumerAuthTokenEndpointInput clientAssertion(@javax.annotation.Nonnull String clientAssertion) {
      
      this.clientAssertion = clientAssertion;
      return this;
    }
  
    /**
     * Get clientAssertion
     * @return clientAssertion
     */
    @javax.annotation.Nonnull
    @JsonProperty(JSON_PROPERTY_CLIENT_ASSERTION)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
  
    public String getClientAssertion() {
      return clientAssertion;
    }
  
  
    @JsonProperty(JSON_PROPERTY_CLIENT_ASSERTION)
    @JsonInclude(value = JsonInclude.Include.ALWAYS)
    public void setClientAssertion(@javax.annotation.Nonnull String clientAssertion) {
      this.clientAssertion = clientAssertion;
    }
  
    public ConsumerAuthTokenEndpointInput code(@javax.annotation.Nullable String code) {
      
      this.code = code;
      return this;
    }
  
    /**
     * Get code
     * @return code
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CODE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  
    public String getCode() {
      return code;
    }
  
  
    @JsonProperty(JSON_PROPERTY_CODE)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setCode(@javax.annotation.Nullable String code) {
      this.code = code;
    }
  
    public ConsumerAuthTokenEndpointInput refreshToken(@javax.annotation.Nullable String refreshToken) {
      
      this.refreshToken = refreshToken;
      return this;
    }
  
    /**
     * Get refreshToken
     * @return refreshToken
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_REFRESH_TOKEN)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  
    public String getRefreshToken() {
      return refreshToken;
    }
  
  
    @JsonProperty(JSON_PROPERTY_REFRESH_TOKEN)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setRefreshToken(@javax.annotation.Nullable String refreshToken) {
      this.refreshToken = refreshToken;
    }
  
    public ConsumerAuthTokenEndpointInput redirectUri(@javax.annotation.Nullable String redirectUri) {
      
      this.redirectUri = redirectUri;
      return this;
    }
  
    /**
     * Get redirectUri
     * @return redirectUri
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_REDIRECT_URI)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  
    public String getRedirectUri() {
      return redirectUri;
    }
  
  
    @JsonProperty(JSON_PROPERTY_REDIRECT_URI)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setRedirectUri(@javax.annotation.Nullable String redirectUri) {
      this.redirectUri = redirectUri;
    }
  
    public ConsumerAuthTokenEndpointInput clientId(@javax.annotation.Nullable String clientId) {
      
      this.clientId = clientId;
      return this;
    }
  
    /**
     * Get clientId
     * @return clientId
     */
    @javax.annotation.Nullable
    @JsonProperty(JSON_PROPERTY_CLIENT_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  
    public String getClientId() {
      return clientId;
    }
  
  
    @JsonProperty(JSON_PROPERTY_CLIENT_ID)
    @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
    public void setClientId(@javax.annotation.Nullable String clientId) {
      this.clientId = clientId;
    }
  
    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (o == null || getClass() != o.getClass()) {
        return false;
      }
      ConsumerAuthTokenEndpointInput consumerAuthTokenEndpointInput = (ConsumerAuthTokenEndpointInput) o;
      return Objects.equals(this.grantType, consumerAuthTokenEndpointInput.grantType) &&
          Objects.equals(this.clientAssertionType, consumerAuthTokenEndpointInput.clientAssertionType) &&
          Objects.equals(this.clientAssertion, consumerAuthTokenEndpointInput.clientAssertion) &&
          Objects.equals(this.code, consumerAuthTokenEndpointInput.code) &&
          Objects.equals(this.refreshToken, consumerAuthTokenEndpointInput.refreshToken) &&
          Objects.equals(this.redirectUri, consumerAuthTokenEndpointInput.redirectUri) &&
          Objects.equals(this.clientId, consumerAuthTokenEndpointInput.clientId);
    }
  
    @Override
    public int hashCode() {
      return Objects.hash(grantType, clientAssertionType, clientAssertion, code, refreshToken, redirectUri, clientId);
    }
  
    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder();
      sb.append("class ConsumerAuthTokenEndpointInput {\n");
      sb.append("    grantType: ").append(toIndentedString(grantType)).append("\n");
      sb.append("    clientAssertionType: ").append(toIndentedString(clientAssertionType)).append("\n");
      sb.append("    clientAssertion: ").append(toIndentedString(clientAssertion)).append("\n");
      sb.append("    code: ").append(toIndentedString(code)).append("\n");
      sb.append("    refreshToken: ").append(toIndentedString(refreshToken)).append("\n");
      sb.append("    redirectUri: ").append(toIndentedString(redirectUri)).append("\n");
      sb.append("    clientId: ").append(toIndentedString(clientId)).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 `grant_type` to the URL query string
      if (getGrantType() != null) {
        try {
          joiner.add(String.format("%sgrant_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getGrantType()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      // add `client_assertion_type` to the URL query string
      if (getClientAssertionType() != null) {
        try {
          joiner.add(String.format("%sclient_assertion_type%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClientAssertionType()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      // add `client_assertion` to the URL query string
      if (getClientAssertion() != null) {
        try {
          joiner.add(String.format("%sclient_assertion%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClientAssertion()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      // add `code` to the URL query string
      if (getCode() != null) {
        try {
          joiner.add(String.format("%scode%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getCode()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      // add `refresh_token` to the URL query string
      if (getRefreshToken() != null) {
        try {
          joiner.add(String.format("%srefresh_token%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getRefreshToken()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      // add `redirect_uri` to the URL query string
      if (getRedirectUri() != null) {
        try {
          joiner.add(String.format("%sredirect_uri%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getRedirectUri()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      // add `client_id` to the URL query string
      if (getClientId() != null) {
        try {
          joiner.add(String.format("%sclient_id%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getClientId()), "UTF-8").replaceAll("\\+", "%20")));
        } catch (UnsupportedEncodingException e) {
          // Should never happen, UTF-8 is always supported
          throw new RuntimeException(e);
        }
      }
  
      return joiner.toString();
    }
  
  }
  
  