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

// LineProtocolErrorCode Code is the machine-readable error code.
type LineProtocolErrorCode string

// List of LineProtocolErrorCode
const (
	LINEPROTOCOLERRORCODE_INTERNAL_ERROR LineProtocolErrorCode = "internal error"
	LINEPROTOCOLERRORCODE_NOT_FOUND      LineProtocolErrorCode = "not found"
	LINEPROTOCOLERRORCODE_CONFLICT       LineProtocolErrorCode = "conflict"
	LINEPROTOCOLERRORCODE_INVALID        LineProtocolErrorCode = "invalid"
	LINEPROTOCOLERRORCODE_EMPTY_VALUE    LineProtocolErrorCode = "empty value"
	LINEPROTOCOLERRORCODE_UNAVAILABLE    LineProtocolErrorCode = "unavailable"
)

func LineProtocolErrorCodeValues() []LineProtocolErrorCode {
	return []LineProtocolErrorCode{"internal error", "not found", "conflict", "invalid", "empty value", "unavailable"}
}

func (v *LineProtocolErrorCode) UnmarshalJSON(src []byte) error {
	var value string
	err := json.Unmarshal(src, &value)
	if err != nil {
		return err
	}
	enumTypeValue := LineProtocolErrorCode(value)
	for _, existing := range []LineProtocolErrorCode{"internal error", "not found", "conflict", "invalid", "empty value", "unavailable"} {
		if existing == enumTypeValue {
			*v = enumTypeValue
			return nil
		}
	}

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

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

type NullableLineProtocolErrorCode struct {
	value *LineProtocolErrorCode
	isSet bool
}

func (v NullableLineProtocolErrorCode) Get() *LineProtocolErrorCode {
	return v.value
}

func (v *NullableLineProtocolErrorCode) Set(val *LineProtocolErrorCode) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableLineProtocolErrorCode(val *LineProtocolErrorCode) *NullableLineProtocolErrorCode {
	return &NullableLineProtocolErrorCode{value: val, isSet: true}
}

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

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