/*
 * Daytona
 * Daytona AI platform API Docs
 *
 * The version of the OpenAPI document: 1.0
 * Contact: support@daytona.com
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package io.daytona.api.client.model;

import java.util.Objects;
import com.google.gson.annotations.SerializedName;

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

/**
 * The desired state of the sandbox
 */
@JsonAdapter(SandboxDesiredState.Adapter.class)
public enum SandboxDesiredState {
  
  DESTROYED("destroyed"),
  
  STARTED("started"),
  
  STOPPED("stopped"),
  
  RESIZED("resized"),
  
  ARCHIVED("archived"),
  
  UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

  private String value;

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

  public String getValue() {
    return value;
  }

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

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

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

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

  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
    String value = jsonElement.getAsString();
    SandboxDesiredState.fromValue(value);
  }
}

