/*
 * Turing Minimal Openapi Spec for SDK
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * API version: 0.0.1
 */

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

package openapi

import (
	"encoding/json"
	"fmt"
)

// EnsemblingJobResultType the model 'EnsemblingJobResultType'
type EnsemblingJobResultType string

// List of EnsemblingJobResultType
const (
	ENSEMBLINGJOBRESULTTYPE_DOUBLE EnsemblingJobResultType = "DOUBLE"
	ENSEMBLINGJOBRESULTTYPE_FLOAT EnsemblingJobResultType = "FLOAT"
	ENSEMBLINGJOBRESULTTYPE_INTEGER EnsemblingJobResultType = "INTEGER"
	ENSEMBLINGJOBRESULTTYPE_LONG EnsemblingJobResultType = "LONG"
	ENSEMBLINGJOBRESULTTYPE_STRING EnsemblingJobResultType = "STRING"
	ENSEMBLINGJOBRESULTTYPE_ARRAY EnsemblingJobResultType = "ARRAY"
)

var allowedEnsemblingJobResultTypeEnumValues = []EnsemblingJobResultType{
	"DOUBLE",
	"FLOAT",
	"INTEGER",
	"LONG",
	"STRING",
	"ARRAY",
}

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

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

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

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

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

type NullableEnsemblingJobResultType struct {
	value *EnsemblingJobResultType
	isSet bool
}

func (v NullableEnsemblingJobResultType) Get() *EnsemblingJobResultType {
	return v.value
}

func (v *NullableEnsemblingJobResultType) Set(val *EnsemblingJobResultType) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableEnsemblingJobResultType(val *EnsemblingJobResultType) *NullableEnsemblingJobResultType {
	return &NullableEnsemblingJobResultType{value: val, isSet: true}
}

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

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

