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

// VolumeState Volume state
type VolumeState string

// List of VolumeState
const (
	VOLUMESTATE_CREATING VolumeState = "creating"
	VOLUMESTATE_READY VolumeState = "ready"
	VOLUMESTATE_PENDING_CREATE VolumeState = "pending_create"
	VOLUMESTATE_PENDING_DELETE VolumeState = "pending_delete"
	VOLUMESTATE_DELETING VolumeState = "deleting"
	VOLUMESTATE_DELETED VolumeState = "deleted"
	VOLUMESTATE_ERROR VolumeState = "error"
	VOLUMESTATE_UNKNOWN_DEFAULT_OPEN_API VolumeState = "11184809"
)

// All allowed values of VolumeState enum
var AllowedVolumeStateEnumValues = []VolumeState{
	"creating",
	"ready",
	"pending_create",
	"pending_delete",
	"deleting",
	"deleted",
	"error",
	"11184809",
}

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

	*v = VOLUMESTATE_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

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

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

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

type NullableVolumeState struct {
	value *VolumeState
	isSet bool
}

func (v NullableVolumeState) Get() *VolumeState {
	return v.value
}

func (v *NullableVolumeState) Set(val *VolumeState) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableVolumeState(val *VolumeState) *NullableVolumeState {
	return &NullableVolumeState{value: val, isSet: true}
}

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

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

