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

// RunnerState The state of the runner
type RunnerState string

// List of RunnerState
const (
	RUNNERSTATE_INITIALIZING RunnerState = "initializing"
	RUNNERSTATE_READY RunnerState = "ready"
	RUNNERSTATE_DISABLED RunnerState = "disabled"
	RUNNERSTATE_DECOMMISSIONED RunnerState = "decommissioned"
	RUNNERSTATE_UNRESPONSIVE RunnerState = "unresponsive"
	RUNNERSTATE_UNKNOWN_DEFAULT_OPEN_API RunnerState = "11184809"
)

// All allowed values of RunnerState enum
var AllowedRunnerStateEnumValues = []RunnerState{
	"initializing",
	"ready",
	"disabled",
	"decommissioned",
	"unresponsive",
	"11184809",
}

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

	*v = RUNNERSTATE_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

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

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

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

type NullableRunnerState struct {
	value *RunnerState
	isSet bool
}

func (v NullableRunnerState) Get() *RunnerState {
	return v.value
}

func (v *NullableRunnerState) Set(val *RunnerState) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRunnerState(val *RunnerState) *NullableRunnerState {
	return &NullableRunnerState{value: val, isSet: true}
}

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

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

