/*
Merlin

API Guide for accessing Merlin's model management, deployment, and serving functionalities

API version: 0.14.0
*/

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

package client

import (
	"encoding/json"
	"fmt"
)

// AlertConditionSeverity the model 'AlertConditionSeverity'
type AlertConditionSeverity string

// List of AlertConditionSeverity
const (
	ALERTCONDITIONSEVERITY_WARNING  AlertConditionSeverity = "WARNING"
	ALERTCONDITIONSEVERITY_CRITICAL AlertConditionSeverity = "CRITICAL"
)

// All allowed values of AlertConditionSeverity enum
var AllowedAlertConditionSeverityEnumValues = []AlertConditionSeverity{
	"WARNING",
	"CRITICAL",
}

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

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

// NewAlertConditionSeverityFromValue returns a pointer to a valid AlertConditionSeverity
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewAlertConditionSeverityFromValue(v string) (*AlertConditionSeverity, error) {
	ev := AlertConditionSeverity(v)
	if ev.IsValid() {
		return &ev, nil
	} else {
		return nil, fmt.Errorf("invalid value '%v' for AlertConditionSeverity: valid values are %v", v, AllowedAlertConditionSeverityEnumValues)
	}
}

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

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

type NullableAlertConditionSeverity struct {
	value *AlertConditionSeverity
	isSet bool
}

func (v NullableAlertConditionSeverity) Get() *AlertConditionSeverity {
	return v.value
}

func (v *NullableAlertConditionSeverity) Set(val *AlertConditionSeverity) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableAlertConditionSeverity(val *AlertConditionSeverity) *NullableAlertConditionSeverity {
	return &NullableAlertConditionSeverity{value: val, isSet: true}
}

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

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