/*
 * 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 io.swagger.annotations.ApiModel;
import com.google.gson.annotations.SerializedName;

import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

/**
 * The status of the payment.  Core lifecycle statuses:  &#x60;PAYMENT_STATUS_INPUT_NEEDED&#x60;: **Transitional.** The payment is awaiting user input to continue processing. It may re-enter this state if additional input is required.  &#x60;PAYMENT_STATUS_AUTHORISING&#x60;: **Transitional.** The payment is being authorised by the financial institution. It will automatically move on once authorisation completes.  &#x60;PAYMENT_STATUS_INITIATED&#x60;: **Transitional.** The payment has been authorised and accepted by the financial institution and is now in transit. A payment should be considered complete once it reaches the &#x60;PAYMENT_STATUS_EXECUTED&#x60; state or the funds settle in the recipient account.  &#x60;PAYMENT_STATUS_EXECUTED&#x60;: **Terminal.** The funds have left the payer’s account and the payment is en route to settlement. Support is more common in the UK than in the EU; where unsupported, a successful payment remains in &#x60;PAYMENT_STATUS_INITIATED&#x60; before settling. When using Plaid Virtual Accounts, &#x60;PAYMENT_STATUS_EXECUTED&#x60; is not terminal—the payment will continue to &#x60;PAYMENT_STATUS_SETTLED&#x60; once funds are available.  &#x60;PAYMENT_STATUS_SETTLED&#x60;: **Terminal.** The funds are available in the recipient’s account. Only available to customers using [Plaid Virtual Accounts](https://plaid.com/docs/payment-initiation/virtual-accounts/).  Failure statuses:  &#x60;PAYMENT_STATUS_INSUFFICIENT_FUNDS&#x60;: **Terminal.** The payment failed due to insufficient funds. No further retries will succeed until the payer’s balance is replenished.  &#x60;PAYMENT_STATUS_FAILED&#x60;: **Terminal (retryable).** The payment could not be initiated due to a system error or outage. Retry once the root cause is resolved.  &#x60;PAYMENT_STATUS_BLOCKED&#x60;: **Terminal (retryable).** The payment was blocked by Plaid (e.g., flagged as risky). Resolve any compliance or risk issues and retry.  &#x60;PAYMENT_STATUS_REJECTED&#x60;: **Terminal.** The payment was rejected by the financial institution. No automatic retry is possible.  &#x60;PAYMENT_STATUS_CANCELLED&#x60;: **Terminal.** The end user cancelled the payment during authorisation.  Standing-order statuses:  &#x60;PAYMENT_STATUS_ESTABLISHED&#x60;: **Terminal.** A recurring/standing order has been successfully created.  Deprecated (to be removed in a future release):  &#x60;PAYMENT_STATUS_UNKNOWN&#x60;: The payment status is unknown.    &#x60;PAYMENT_STATUS_PROCESSING&#x60;: The payment is currently being processed.    &#x60;PAYMENT_STATUS_COMPLETED&#x60;: Indicates that the standing order has been successfully established.
 */
@JsonAdapter(PaymentInitiationPaymentStatus.Adapter.class)
public enum PaymentInitiationPaymentStatus {
  
  INPUT_NEEDED("PAYMENT_STATUS_INPUT_NEEDED"),
  
  PROCESSING("PAYMENT_STATUS_PROCESSING"),
  
  INITIATED("PAYMENT_STATUS_INITIATED"),
  
  COMPLETED("PAYMENT_STATUS_COMPLETED"),
  
  INSUFFICIENT_FUNDS("PAYMENT_STATUS_INSUFFICIENT_FUNDS"),
  
  FAILED("PAYMENT_STATUS_FAILED"),
  
  BLOCKED("PAYMENT_STATUS_BLOCKED"),
  
  UNKNOWN("PAYMENT_STATUS_UNKNOWN"),
  
  EXECUTED("PAYMENT_STATUS_EXECUTED"),
  
  SETTLED("PAYMENT_STATUS_SETTLED"),
  
  AUTHORISING("PAYMENT_STATUS_AUTHORISING"),
  
  CANCELLED("PAYMENT_STATUS_CANCELLED"),
  
  ESTABLISHED("PAYMENT_STATUS_ESTABLISHED"),
  
  REJECTED("PAYMENT_STATUS_REJECTED"),

  // This is returned when an enum is returned from the API that doesn't exist in the OpenAPI file.
  // Try upgrading your client-library version.
  ENUM_UNKNOWN("ENUM_UNKNOWN");

  private String value;

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

  public String getValue() {
    return value;
  }

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

  public static PaymentInitiationPaymentStatus fromValue(String value) {
    for (PaymentInitiationPaymentStatus b : PaymentInitiationPaymentStatus.values()) {
      if (b.value.equals(value)) {
        return b;
      }
    }
    
    return PaymentInitiationPaymentStatus.ENUM_UNKNOWN;
  }

  public static class Adapter extends TypeAdapter<PaymentInitiationPaymentStatus> {
    @Override
    public void write(final JsonWriter jsonWriter, final PaymentInitiationPaymentStatus enumeration) throws IOException {
      jsonWriter.value(enumeration.getValue());
    }

    @Override
    public PaymentInitiationPaymentStatus read(final JsonReader jsonReader) throws IOException {
      String value = jsonReader.nextString();
      return PaymentInitiationPaymentStatus.fromValue(value);
    }
  }
}

