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

// RegionType The type of the region
type RegionType string

// List of RegionType
const (
	REGIONTYPE_SHARED RegionType = "shared"
	REGIONTYPE_DEDICATED RegionType = "dedicated"
	REGIONTYPE_CUSTOM RegionType = "custom"
	REGIONTYPE_UNKNOWN_DEFAULT_OPEN_API RegionType = "11184809"
)

// All allowed values of RegionType enum
var AllowedRegionTypeEnumValues = []RegionType{
	"shared",
	"dedicated",
	"custom",
	"11184809",
}

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

	*v = REGIONTYPE_UNKNOWN_DEFAULT_OPEN_API
	return nil
}

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

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

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

type NullableRegionType struct {
	value *RegionType
	isSet bool
}

func (v NullableRegionType) Get() *RegionType {
	return v.value
}

func (v *NullableRegionType) Set(val *RegionType) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRegionType(val *RegionType) *NullableRegionType {
	return &NullableRegionType{value: val, isSet: true}
}

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

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

