/*
 * Subset of Influx API covered by Influx CLI
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * API version: 2.0.0
 */

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

package api

import (
	"encoding/json"
	"fmt"
)

// ScriptLanguage the model 'ScriptLanguage'
type ScriptLanguage string

// List of ScriptLanguage
const (
	SCRIPTLANGUAGE_FLUX ScriptLanguage = "flux"
	SCRIPTLANGUAGE_SQL  ScriptLanguage = "sql"
)

func ScriptLanguageValues() []ScriptLanguage {
	return []ScriptLanguage{"flux", "sql"}
}

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

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

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

type NullableScriptLanguage struct {
	value *ScriptLanguage
	isSet bool
}

func (v NullableScriptLanguage) Get() *ScriptLanguage {
	return v.value
}

func (v *NullableScriptLanguage) Set(val *ScriptLanguage) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableScriptLanguage(val *ScriptLanguage) *NullableScriptLanguage {
	return &NullableScriptLanguage{value: val, isSet: true}
}

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

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