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

// ModelPredictionOutputClass the model 'ModelPredictionOutputClass'
type ModelPredictionOutputClass string

// List of ModelPredictionOutputClass
const (
	MODELPREDICTIONOUTPUTCLASS_BINARY_CLASSIFICATION_OUTPUT ModelPredictionOutputClass = "BinaryClassificationOutput"
	MODELPREDICTIONOUTPUTCLASS_RANKING_OUTPUT               ModelPredictionOutputClass = "RankingOutput"
	MODELPREDICTIONOUTPUTCLASS_REGRESSION_OUTPUT            ModelPredictionOutputClass = "RegressionOutput"
)

// All allowed values of ModelPredictionOutputClass enum
var AllowedModelPredictionOutputClassEnumValues = []ModelPredictionOutputClass{
	"BinaryClassificationOutput",
	"RankingOutput",
	"RegressionOutput",
}

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

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

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

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

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

type NullableModelPredictionOutputClass struct {
	value *ModelPredictionOutputClass
	isSet bool
}

func (v NullableModelPredictionOutputClass) Get() *ModelPredictionOutputClass {
	return v.value
}

func (v *NullableModelPredictionOutputClass) Set(val *ModelPredictionOutputClass) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableModelPredictionOutputClass(val *ModelPredictionOutputClass) *NullableModelPredictionOutputClass {
	return &NullableModelPredictionOutputClass{value: val, isSet: true}
}

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

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