/*
 * 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 income category. &#x60;BANK_INTEREST&#x60;: Interest earned from a bank account. &#x60;BENEFIT_OTHER&#x60;: Government benefits other than retirement, unemployment, child support, or disability. Currently used only in the UK, to represent benefits such as Cost of Living Payments. &#x60;CASH&#x60;: Deprecated and used only for existing legacy implementations. Has been replaced by &#x60;CASH_DEPOSIT&#x60; and &#x60;TRANSFER_FROM_APPLICATION&#x60;. &#x60;CASH_DEPOSIT&#x60;: A cash or check deposit. &#x60;CHILD_SUPPORT&#x60;: Child support payments received. &#x60;GIG_ECONOMY&#x60;: Income earned as a gig economy worker, e.g. driving for Uber, Lyft, Postmates, DoorDash, etc. &#x60;LONG_TERM_DISABILITY&#x60;: Disability payments, including Social Security disability benefits. &#x60;OTHER&#x60;: Income that could not be categorized as any other income category. &#x60;MILITARY&#x60;: Veterans benefits. Income earned as salary for serving in the military (e.g. through DFAS) will be classified as &#x60;SALARY&#x60; rather than &#x60;MILITARY&#x60;. &#x60;RENTAL&#x60;: Income earned from a rental property. Income may be identified as rental when the payment is received through a rental platform, e.g. Airbnb; rent paid directly by the tenant to the property owner (e.g. via cash, check, or ACH) will typically not be classified as rental income. &#x60;RETIREMENT&#x60;: Payments from private retirement systems, pensions, and government retirement programs, including Social Security retirement benefits. &#x60;SALARY&#x60;: Payment from an employer to an earner or other form of permanent employment. &#x60;TAX_REFUND&#x60;: A tax refund. &#x60;TRANSFER_FROM_APPLICATION&#x60;: Deposits from a money transfer app, such as Venmo, Cash App, or Zelle. &#x60;UNEMPLOYMENT&#x60;: Unemployment benefits. In the UK, includes certain low-income benefits such as the Universal Credit.
 */
@JsonAdapter(CreditBankIncomeCategory.Adapter.class)
public enum CreditBankIncomeCategory {
  
  SALARY("SALARY"),
  
  UNEMPLOYMENT("UNEMPLOYMENT"),
  
  CASH("CASH"),
  
  GIG_ECONOMY("GIG_ECONOMY"),
  
  RENTAL("RENTAL"),
  
  CHILD_SUPPORT("CHILD_SUPPORT"),
  
  MILITARY("MILITARY"),
  
  RETIREMENT("RETIREMENT"),
  
  LONG_TERM_DISABILITY("LONG_TERM_DISABILITY"),
  
  BANK_INTEREST("BANK_INTEREST"),
  
  CASH_DEPOSIT("CASH_DEPOSIT"),
  
  TRANSFER_FROM_APPLICATION("TRANSFER_FROM_APPLICATION"),
  
  TAX_REFUND("TAX_REFUND"),
  
  BENEFIT_OTHER("BENEFIT_OTHER"),
  
  OTHER("OTHER"),

  // 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;

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

  public String getValue() {
    return value;
  }

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

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

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

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

