/*
Hindsight HTTP API

HTTP API for Hindsight

API version: 0.5.3
*/

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

package hindsight

import (
	"encoding/json"
	"fmt"
)

// Budget Budget levels for recall/reflect operations.
type Budget string

// List of Budget
const (
	LOW Budget = "low"
	MID Budget = "mid"
	HIGH Budget = "high"
)

// All allowed values of Budget enum
var AllowedBudgetEnumValues = []Budget{
	"low",
	"mid",
	"high",
}

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

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

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

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

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

type NullableBudget struct {
	value *Budget
	isSet bool
}

func (v NullableBudget) Get() *Budget {
	return v.value
}

func (v *NullableBudget) Set(val *Budget) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBudget(val *Budget) *NullableBudget {
	return &NullableBudget{value: val, isSet: true}
}

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

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

