// Code generated by "enumer -type ProfileEventType -trimprefix Profile -text -json -output profile_enum.go"; DO NOT EDIT.

package proto

import (
	"encoding/json"
	"fmt"
	"strings"
)

const _ProfileEventTypeName = "IncrementGauge"

var _ProfileEventTypeIndex = [...]uint8{0, 9, 14}

const _ProfileEventTypeLowerName = "incrementgauge"

func (i ProfileEventType) String() string {
	i -= 1
	if i >= ProfileEventType(len(_ProfileEventTypeIndex)-1) {
		return fmt.Sprintf("ProfileEventType(%d)", i+1)
	}
	return _ProfileEventTypeName[_ProfileEventTypeIndex[i]:_ProfileEventTypeIndex[i+1]]
}

// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _ProfileEventTypeNoOp() {
	var x [1]struct{}
	_ = x[ProfileIncrement-(1)]
	_ = x[ProfileGauge-(2)]
}

var _ProfileEventTypeValues = []ProfileEventType{ProfileIncrement, ProfileGauge}

var _ProfileEventTypeNameToValueMap = map[string]ProfileEventType{
	_ProfileEventTypeName[0:9]:       ProfileIncrement,
	_ProfileEventTypeLowerName[0:9]:  ProfileIncrement,
	_ProfileEventTypeName[9:14]:      ProfileGauge,
	_ProfileEventTypeLowerName[9:14]: ProfileGauge,
}

var _ProfileEventTypeNames = []string{
	_ProfileEventTypeName[0:9],
	_ProfileEventTypeName[9:14],
}

// ProfileEventTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func ProfileEventTypeString(s string) (ProfileEventType, error) {
	if val, ok := _ProfileEventTypeNameToValueMap[s]; ok {
		return val, nil
	}

	if val, ok := _ProfileEventTypeNameToValueMap[strings.ToLower(s)]; ok {
		return val, nil
	}
	return 0, fmt.Errorf("%s does not belong to ProfileEventType values", s)
}

// ProfileEventTypeValues returns all values of the enum
func ProfileEventTypeValues() []ProfileEventType {
	return _ProfileEventTypeValues
}

// ProfileEventTypeStrings returns a slice of all String values of the enum
func ProfileEventTypeStrings() []string {
	strs := make([]string, len(_ProfileEventTypeNames))
	copy(strs, _ProfileEventTypeNames)
	return strs
}

// IsAProfileEventType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i ProfileEventType) IsAProfileEventType() bool {
	for _, v := range _ProfileEventTypeValues {
		if i == v {
			return true
		}
	}
	return false
}

// MarshalJSON implements the json.Marshaler interface for ProfileEventType
func (i ProfileEventType) MarshalJSON() ([]byte, error) {
	return json.Marshal(i.String())
}

// UnmarshalJSON implements the json.Unmarshaler interface for ProfileEventType
func (i *ProfileEventType) UnmarshalJSON(data []byte) error {
	var s string
	if err := json.Unmarshal(data, &s); err != nil {
		return fmt.Errorf("ProfileEventType should be a string, got %s", data)
	}

	var err error
	*i, err = ProfileEventTypeString(s)
	return err
}

// MarshalText implements the encoding.TextMarshaler interface for ProfileEventType
func (i ProfileEventType) MarshalText() ([]byte, error) {
	return []byte(i.String()), nil
}

// UnmarshalText implements the encoding.TextUnmarshaler interface for ProfileEventType
func (i *ProfileEventType) UnmarshalText(text []byte) error {
	var err error
	*i, err = ProfileEventTypeString(string(text))
	return err
}
