/*
 * 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 type of the job
 */
@JsonAdapter(JobType.Adapter.class)
public enum JobType {
  
  CREATE_SANDBOX("CREATE_SANDBOX"),
  
  START_SANDBOX("START_SANDBOX"),
  
  STOP_SANDBOX("STOP_SANDBOX"),
  
  DESTROY_SANDBOX("DESTROY_SANDBOX"),
  
  RESIZE_SANDBOX("RESIZE_SANDBOX"),
  
  CREATE_BACKUP("CREATE_BACKUP"),
  
  BUILD_SNAPSHOT("BUILD_SNAPSHOT"),
  
  PULL_SNAPSHOT("PULL_SNAPSHOT"),
  
  RECOVER_SANDBOX("RECOVER_SANDBOX"),
  
  INSPECT_SNAPSHOT_IN_REGISTRY("INSPECT_SNAPSHOT_IN_REGISTRY"),
  
  REMOVE_SNAPSHOT("REMOVE_SNAPSHOT"),
  
  UPDATE_SANDBOX_NETWORK_SETTINGS("UPDATE_SANDBOX_NETWORK_SETTINGS"),
  
  SNAPSHOT_SANDBOX("SNAPSHOT_SANDBOX"),
  
  FORK_SANDBOX("FORK_SANDBOX"),
  
  UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

  private String value;

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

  public String getValue() {
    return value;
  }

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

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

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

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

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

