/*
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"
)

// SandboxDesiredState The desired state of the sandbox
type SandboxDesiredState string

// List of SandboxDesiredState
const (
	SANDBOXDESIREDSTATE_DESTROYED SandboxDesiredState = "destroyed"
	SANDBOXDESIREDSTATE_STARTED SandboxDesiredState = "started"
	SANDBOXDESIREDSTATE_STOPPED SandboxDesiredState = "stopped"
	SANDBOXDESIREDSTATE_RESIZED SandboxDesiredState = "resized"
	SANDBOXDESIREDSTATE_ARCHIVED SandboxDesiredState = "archived"
	SANDBOXDESIREDSTATE_UNKNOWN_DEFAULT_OPEN_API SandboxDesiredState = "11184809"
)

// All allowed values of SandboxDesiredState enum
var AllowedSandboxDesiredStateEnumValues = []SandboxDesiredState{
	"destroyed",
	"started",
	"stopped",
	"resized",
	"archived",
	"11184809",
}

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

	*v = SANDBOXDESIREDSTATE_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

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

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

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

type NullableSandboxDesiredState struct {
	value *SandboxDesiredState
	isSet bool
}

func (v NullableSandboxDesiredState) Get() *SandboxDesiredState {
	return v.value
}

func (v *NullableSandboxDesiredState) Set(val *SandboxDesiredState) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableSandboxDesiredState(val *SandboxDesiredState) *NullableSandboxDesiredState {
	return &NullableSandboxDesiredState{value: val, isSet: true}
}

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

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

