java/src/main/java/com/konfigthis/newscatcherapi/client/model/PublishDatePrecision.java
/*
 * NewsCatcher News API V2
 * NewsCatcher is a data-as-a-service startup that has one main goal: to build the largest database of structured news articles published online. In other words, we're like Google for the news part of the web, which you can access as a source of data.  Some useful links: - [How NewsCatcher Works](https://docs.newscatcherapi.com/knowledge-base/how-newscatcher-works) - [GitHub for the Python SDK](https://github.com/NewscatcherAPI/newscatcherapi-sdk-python) 
 *
 * The version of the OpenAPI document: 1.0.1
 * Contact: upchh@example.com
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.newscatcherapi.client.model;

import java.util.Objects;
import java.util.Arrays;
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;

/**
 * Gets or Sets publish_date_precision
 */
@JsonAdapter(PublishDatePrecision.Adapter.class)
public enum PublishDatePrecision {
  
  FULL("full"),
  
  TIMEZONE_UNKNOWN("timezone unknown"),
  
  DATE("date");

  private String value;

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

  public String getValue() {
    return value;
  }

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

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

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

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

