/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package apiclient

import (
	"encoding/json"
)

// JobType The type of the job
type JobType string

// List of JobType
const (
	JOBTYPE_CREATE_SANDBOX JobType = "CREATE_SANDBOX"
	JOBTYPE_START_SANDBOX JobType = "START_SANDBOX"
	JOBTYPE_STOP_SANDBOX JobType = "STOP_SANDBOX"
	JOBTYPE_DESTROY_SANDBOX JobType = "DESTROY_SANDBOX"
	JOBTYPE_RESIZE_SANDBOX JobType = "RESIZE_SANDBOX"
	JOBTYPE_CREATE_BACKUP JobType = "CREATE_BACKUP"
	JOBTYPE_BUILD_SNAPSHOT JobType = "BUILD_SNAPSHOT"
	JOBTYPE_PULL_SNAPSHOT JobType = "PULL_SNAPSHOT"
	JOBTYPE_RECOVER_SANDBOX JobType = "RECOVER_SANDBOX"
	JOBTYPE_INSPECT_SNAPSHOT_IN_REGISTRY JobType = "INSPECT_SNAPSHOT_IN_REGISTRY"
	JOBTYPE_REMOVE_SNAPSHOT JobType = "REMOVE_SNAPSHOT"
	JOBTYPE_UPDATE_SANDBOX_NETWORK_SETTINGS JobType = "UPDATE_SANDBOX_NETWORK_SETTINGS"
	JOBTYPE_SNAPSHOT_SANDBOX JobType = "SNAPSHOT_SANDBOX"
	JOBTYPE_FORK_SANDBOX JobType = "FORK_SANDBOX"
	JOBTYPE_UNKNOWN_DEFAULT_OPEN_API JobType = "11184809"
)

// All allowed values of JobType enum
var AllowedJobTypeEnumValues = []JobType{
	"CREATE_SANDBOX",
	"START_SANDBOX",
	"STOP_SANDBOX",
	"DESTROY_SANDBOX",
	"RESIZE_SANDBOX",
	"CREATE_BACKUP",
	"BUILD_SNAPSHOT",
	"PULL_SNAPSHOT",
	"RECOVER_SANDBOX",
	"INSPECT_SNAPSHOT_IN_REGISTRY",
	"REMOVE_SNAPSHOT",
	"UPDATE_SANDBOX_NETWORK_SETTINGS",
	"SNAPSHOT_SANDBOX",
	"FORK_SANDBOX",
	"11184809",
}

func (v *JobType) UnmarshalJSON(src []byte) error {
	var value string
	err := json.Unmarshal(src, &value)
	if err != nil {
		return err
	}
	enumTypeValue := JobType(value)
	for _, existing := range AllowedJobTypeEnumValues {
		if existing == enumTypeValue {
			*v = enumTypeValue
			return nil
		}
	}

	*v = JOBTYPE_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

// NewJobTypeFromValue returns a pointer to a valid JobType
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewJobTypeFromValue(v string) (*JobType, error) {
	ev := JobType(v)
	if ev.IsValid() {
		return &ev, nil
	} else {
		enumValue := JOBTYPE_UNKNOWN_DEFAULT_OPEN_API
		return &enumValue, nil
	}
}

// IsValid return true if the value is valid for the enum, false otherwise
func (v JobType) IsValid() bool {
	for _, existing := range AllowedJobTypeEnumValues {
		if existing == v {
			return true
		}
	}
	return false
}

// Ptr returns reference to JobType value
func (v JobType) Ptr() *JobType {
	return &v
}

type NullableJobType struct {
	value *JobType
	isSet bool
}

func (v NullableJobType) Get() *JobType {
	return v.value
}

func (v *NullableJobType) Set(val *JobType) {
	v.value = val
	v.isSet = true
}

func (v NullableJobType) IsSet() bool {
	return v.isSet
}

func (v *NullableJobType) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableJobType(val *JobType) *NullableJobType {
	return &NullableJobType{value: val, isSet: true}
}

func (v NullableJobType) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableJobType) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}

