sdks/java/src/main/java/com/konfigthis/client/model/OrderType.java
<reponame>passiv/snaptrade-sdks<filename>sdks/java/src/main/java/com/konfigthis/client/model/OrderType.java/*
 * SnapTrade
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: kenaa@example.com
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.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;

/**
 * Order Type
 */
@JsonAdapter(OrderType.Adapter.class)
public enum OrderType {
  
  LIMIT("Limit"),
  
  MARKET("Market"),
  
  STOPLIMIT("StopLimit"),
  
  STOPLOSS("StopLoss");

  private String value;

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

  public String getValue() {
    return value;
  }

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

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

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

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

