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

// SandboxState The state of the sandbox
type SandboxState string

// List of SandboxState
const (
	SANDBOXSTATE_CREATING SandboxState = "creating"
	SANDBOXSTATE_RESTORING SandboxState = "restoring"
	SANDBOXSTATE_DESTROYED SandboxState = "destroyed"
	SANDBOXSTATE_DESTROYING SandboxState = "destroying"
	SANDBOXSTATE_STARTED SandboxState = "started"
	SANDBOXSTATE_STOPPED SandboxState = "stopped"
	SANDBOXSTATE_STARTING SandboxState = "starting"
	SANDBOXSTATE_STOPPING SandboxState = "stopping"
	SANDBOXSTATE_ERROR SandboxState = "error"
	SANDBOXSTATE_BUILD_FAILED SandboxState = "build_failed"
	SANDBOXSTATE_PENDING_BUILD SandboxState = "pending_build"
	SANDBOXSTATE_BUILDING_SNAPSHOT SandboxState = "building_snapshot"
	SANDBOXSTATE_UNKNOWN SandboxState = "unknown"
	SANDBOXSTATE_PULLING_SNAPSHOT SandboxState = "pulling_snapshot"
	SANDBOXSTATE_ARCHIVED SandboxState = "archived"
	SANDBOXSTATE_ARCHIVING SandboxState = "archiving"
	SANDBOXSTATE_RESIZING SandboxState = "resizing"
	SANDBOXSTATE_SNAPSHOTTING SandboxState = "snapshotting"
	SANDBOXSTATE_FORKING SandboxState = "forking"
	SANDBOXSTATE_UNKNOWN_DEFAULT_OPEN_API SandboxState = "11184809"
)

// All allowed values of SandboxState enum
var AllowedSandboxStateEnumValues = []SandboxState{
	"creating",
	"restoring",
	"destroyed",
	"destroying",
	"started",
	"stopped",
	"starting",
	"stopping",
	"error",
	"build_failed",
	"pending_build",
	"building_snapshot",
	"unknown",
	"pulling_snapshot",
	"archived",
	"archiving",
	"resizing",
	"snapshotting",
	"forking",
	"11184809",
}

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

	*v = SANDBOXSTATE_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

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

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

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

type NullableSandboxState struct {
	value *SandboxState
	isSet bool
}

func (v NullableSandboxState) Get() *SandboxState {
	return v.value
}

func (v *NullableSandboxState) Set(val *SandboxState) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableSandboxState(val *SandboxState) *NullableSandboxState {
	return &NullableSandboxState{value: val, isSet: true}
}

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

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

