/*
 * The Plaid API
 * The Plaid REST API. Please see https://plaid.com/docs/api for more details.
 *
 * The version of the OpenAPI document: 2020-09-14_1.680.0
 * 
 *
 * 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.plaid.client.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.plaid.client.model.OAuthGrantType;
import com.plaid.client.model.OAuthSubjectTokenType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;

/**
 * OAuth token grant request.
 */
@ApiModel(description = "OAuth token grant request.")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-12-11T18:58:39.328614Z[Etc/UTC]")
public class OAuthTokenRequest {
  public static final String SERIALIZED_NAME_GRANT_TYPE = "grant_type";
  @SerializedName(SERIALIZED_NAME_GRANT_TYPE)
  private OAuthGrantType grantType;

  public static final String SERIALIZED_NAME_CLIENT_ID = "client_id";
  @SerializedName(SERIALIZED_NAME_CLIENT_ID)
  private String clientId;

  public static final String SERIALIZED_NAME_CLIENT_SECRET = "client_secret";
  @SerializedName(SERIALIZED_NAME_CLIENT_SECRET)
  private String clientSecret;

  public static final String SERIALIZED_NAME_SECRET = "secret";
  @SerializedName(SERIALIZED_NAME_SECRET)
  private String secret;

  public static final String SERIALIZED_NAME_SCOPE = "scope";
  @SerializedName(SERIALIZED_NAME_SCOPE)
  private String scope;

  public static final String SERIALIZED_NAME_REFRESH_TOKEN = "refresh_token";
  @SerializedName(SERIALIZED_NAME_REFRESH_TOKEN)
  private String refreshToken;

  public static final String SERIALIZED_NAME_RESOURCE = "resource";
  @SerializedName(SERIALIZED_NAME_RESOURCE)
  private String resource;

  public static final String SERIALIZED_NAME_AUDIENCE = "audience";
  @SerializedName(SERIALIZED_NAME_AUDIENCE)
  private String audience;

  public static final String SERIALIZED_NAME_SUBJECT_TOKEN = "subject_token";
  @SerializedName(SERIALIZED_NAME_SUBJECT_TOKEN)
  private String subjectToken;

  public static final String SERIALIZED_NAME_SUBJECT_TOKEN_TYPE = "subject_token_type";
  @SerializedName(SERIALIZED_NAME_SUBJECT_TOKEN_TYPE)
  private OAuthSubjectTokenType subjectTokenType;


  public OAuthTokenRequest grantType(OAuthGrantType grantType) {
    
    this.grantType = grantType;
    return this;
  }

   /**
   * Get grantType
   * @return grantType
  **/
  @ApiModelProperty(required = true, value = "")

  public OAuthGrantType getGrantType() {
    return grantType;
  }


  public void setGrantType(OAuthGrantType grantType) {
    this.grantType = grantType;
  }


  public OAuthTokenRequest clientId(String clientId) {
    
    this.clientId = clientId;
    return this;
  }

   /**
   * Your Plaid API &#x60;client_id&#x60;. The &#x60;client_id&#x60; is required and may be provided either in the &#x60;PLAID-CLIENT-ID&#x60; header or as part of a request body.
   * @return clientId
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Your Plaid API `client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.")

  public String getClientId() {
    return clientId;
  }


  public void setClientId(String clientId) {
    this.clientId = clientId;
  }


  public OAuthTokenRequest clientSecret(String clientSecret) {
    
    this.clientSecret = clientSecret;
    return this;
  }

   /**
   * Your Plaid API &#x60;secret&#x60;. The &#x60;secret&#x60; is required and may be provided either in the &#x60;PLAID-SECRET&#x60; header or as part of a request body as either &#x60;secret&#x60; or &#x60;client_secret&#x60;.
   * @return clientSecret
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Your Plaid API `secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body as either `secret` or `client_secret`.")

  public String getClientSecret() {
    return clientSecret;
  }


  public void setClientSecret(String clientSecret) {
    this.clientSecret = clientSecret;
  }


  public OAuthTokenRequest secret(String secret) {
    
    this.secret = secret;
    return this;
  }

   /**
   * Your Plaid API &#x60;secret&#x60;. The &#x60;secret&#x60; is required and may be provided either in the &#x60;PLAID-SECRET&#x60; header or as part of a request body as either &#x60;secret&#x60; or &#x60;client_secret&#x60;.
   * @return secret
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Your Plaid API `secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body as either `secret` or `client_secret`.")

  public String getSecret() {
    return secret;
  }


  public void setSecret(String secret) {
    this.secret = secret;
  }


  public OAuthTokenRequest scope(String scope) {
    
    this.scope = scope;
    return this;
  }

   /**
   * A JSON string containing a space-separated list of scopes associated with this token, in the format described in [https://datatracker.ietf.org/doc/html/rfc6749#section-3.3](https://datatracker.ietf.org/doc/html/rfc6749#section-3.3). Currently accepted values are:  &#x60;user:read&#x60; allows reading user data. &#x60;user:write&#x60; allows writing user data. &#x60;exchange&#x60; allows exchanging a token using the &#x60;urn:plaid:params:oauth:user-token&#x60; grant type. &#x60;mcp:dashboard&#x60; allows access to the MCP dashboard server.
   * @return scope
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "user:read user:write exchange", value = "A JSON string containing a space-separated list of scopes associated with this token, in the format described in [https://datatracker.ietf.org/doc/html/rfc6749#section-3.3](https://datatracker.ietf.org/doc/html/rfc6749#section-3.3). Currently accepted values are:  `user:read` allows reading user data. `user:write` allows writing user data. `exchange` allows exchanging a token using the `urn:plaid:params:oauth:user-token` grant type. `mcp:dashboard` allows access to the MCP dashboard server.")

  public String getScope() {
    return scope;
  }


  public void setScope(String scope) {
    this.scope = scope;
  }


  public OAuthTokenRequest refreshToken(String refreshToken) {
    
    this.refreshToken = refreshToken;
    return this;
  }

   /**
   * Refresh token for OAuth
   * @return refreshToken
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Refresh token for OAuth")

  public String getRefreshToken() {
    return refreshToken;
  }


  public void setRefreshToken(String refreshToken) {
    this.refreshToken = refreshToken;
  }


  public OAuthTokenRequest resource(String resource) {
    
    this.resource = resource;
    return this;
  }

   /**
   * URI of the target resource server
   * @return resource
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "https://production.plaid.com", value = "URI of the target resource server")

  public String getResource() {
    return resource;
  }


  public void setResource(String resource) {
    this.resource = resource;
  }


  public OAuthTokenRequest audience(String audience) {
    
    this.audience = audience;
    return this;
  }

   /**
   * Used when exchanging a token. The meaning depends on the &#x60;subject_token_type&#x60;:  - For &#x60;urn:plaid:params:tokens:user&#x60;: Must be the same as the &#x60;client_id&#x60;. - For &#x60;urn:plaid:params:oauth:user-token&#x60;: The other &#x60;client_id&#x60; to exchange tokens to. - For &#x60;urn:plaid:params:credit:multi-user&#x60;:  a &#x60;client_id&#x60; or one of the supported CRA partner URNs: &#x60;urn:plaid:params:cra-partner:experian&#x60;, &#x60;urn:plaid:params:cra-partner:fannie-mae&#x60;, or &#x60;urn:plaid:params:cra-partner:freddie-mac&#x60;.
   * @return audience
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "68028ce48d2b0dec68747f6c", value = "Used when exchanging a token. The meaning depends on the `subject_token_type`:  - For `urn:plaid:params:tokens:user`: Must be the same as the `client_id`. - For `urn:plaid:params:oauth:user-token`: The other `client_id` to exchange tokens to. - For `urn:plaid:params:credit:multi-user`:  a `client_id` or one of the supported CRA partner URNs: `urn:plaid:params:cra-partner:experian`, `urn:plaid:params:cra-partner:fannie-mae`, or `urn:plaid:params:cra-partner:freddie-mac`.")

  public String getAudience() {
    return audience;
  }


  public void setAudience(String audience) {
    this.audience = audience;
  }


  public OAuthTokenRequest subjectToken(String subjectToken) {
    
    this.subjectToken = subjectToken;
    return this;
  }

   /**
   * Token representing the subject. The &#x60;subject token&#x60; must be an OAuth refresh token issued from the &#x60;/oauth/token&#x60; endpoint. The meaning depends on the &#x60;subject_token_type&#x60;.
   * @return subjectToken
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(example = "user-sandbox-b0e2c4ee-a763-4df5-bfe9-46a46bce993d", value = "Token representing the subject. The `subject token` must be an OAuth refresh token issued from the `/oauth/token` endpoint. The meaning depends on the `subject_token_type`.")

  public String getSubjectToken() {
    return subjectToken;
  }


  public void setSubjectToken(String subjectToken) {
    this.subjectToken = subjectToken;
  }


  public OAuthTokenRequest subjectTokenType(OAuthSubjectTokenType subjectTokenType) {
    
    this.subjectTokenType = subjectTokenType;
    return this;
  }

   /**
   * Get subjectTokenType
   * @return subjectTokenType
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public OAuthSubjectTokenType getSubjectTokenType() {
    return subjectTokenType;
  }


  public void setSubjectTokenType(OAuthSubjectTokenType subjectTokenType) {
    this.subjectTokenType = subjectTokenType;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    OAuthTokenRequest oauthTokenRequest = (OAuthTokenRequest) o;
    return Objects.equals(this.grantType, oauthTokenRequest.grantType) &&
        Objects.equals(this.clientId, oauthTokenRequest.clientId) &&
        Objects.equals(this.clientSecret, oauthTokenRequest.clientSecret) &&
        Objects.equals(this.secret, oauthTokenRequest.secret) &&
        Objects.equals(this.scope, oauthTokenRequest.scope) &&
        Objects.equals(this.refreshToken, oauthTokenRequest.refreshToken) &&
        Objects.equals(this.resource, oauthTokenRequest.resource) &&
        Objects.equals(this.audience, oauthTokenRequest.audience) &&
        Objects.equals(this.subjectToken, oauthTokenRequest.subjectToken) &&
        Objects.equals(this.subjectTokenType, oauthTokenRequest.subjectTokenType);
  }

  @Override
  public int hashCode() {
    return Objects.hash(grantType, clientId, clientSecret, secret, scope, refreshToken, resource, audience, subjectToken, subjectTokenType);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class OAuthTokenRequest {\n");
    sb.append("    grantType: ").append(toIndentedString(grantType)).append("\n");
    sb.append("    clientId: ").append(toIndentedString(clientId)).append("\n");
    sb.append("    clientSecret: ").append(toIndentedString(clientSecret)).append("\n");
    sb.append("    secret: ").append(toIndentedString(secret)).append("\n");
    sb.append("    scope: ").append(toIndentedString(scope)).append("\n");
    sb.append("    refreshToken: ").append(toIndentedString(refreshToken)).append("\n");
    sb.append("    resource: ").append(toIndentedString(resource)).append("\n");
    sb.append("    audience: ").append(toIndentedString(audience)).append("\n");
    sb.append("    subjectToken: ").append(toIndentedString(subjectToken)).append("\n");
    sb.append("    subjectTokenType: ").append(toIndentedString(subjectTokenType)).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    ");
  }

}

