/*
 * VM Auto Scaling API
 *
 * The VM Auto Scaling Service enables IONOS clients to horizontally scale the number of VM replicas based on configured rules. You can use VM Auto Scaling to ensure that you have a sufficient number of replicas to handle your application loads at all times.  For this purpose, create a VM Auto Scaling Group that contains the server replicas. The VM Auto Scaling Service ensures that the number of replicas in the group is always within the defined limits.   When scaling policies are set, VM Auto Scaling creates or deletes replicas according to the requirements of your applications. For each policy, specified 'scale-in' and 'scale-out' actions are performed when the corresponding thresholds are reached.
 *
 * API version: 1-SDK.1
 * Contact: support@cloud.ionos.com
 */

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package ionoscloud

import (
	"encoding/json"
	"fmt"
)

// CpuFamily The CPU family for the VMs created with this configuration. If the value is 'null', the VM is created with the default CPU family for the assigned site.
type CpuFamily string

// List of CpuFamily
const (
	CPUFAMILY_AMD_OPTERON   CpuFamily = "AMD_OPTERON"
	CPUFAMILY_INTEL_SKYLAKE CpuFamily = "INTEL_SKYLAKE"
	CPUFAMILY_INTEL_XEON    CpuFamily = "INTEL_XEON"
)

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

	return fmt.Errorf("%+v is not a valid CpuFamily", value)
}

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

type NullableCpuFamily struct {
	value *CpuFamily
	isSet bool
}

func (v NullableCpuFamily) Get() *CpuFamily {
	return v.value
}

func (v *NullableCpuFamily) Set(val *CpuFamily) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCpuFamily(val *CpuFamily) *NullableCpuFamily {
	return &NullableCpuFamily{value: val, isSet: true}
}

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

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