// Code generated by "enumer -type IntervalScale -output interval_enum.go"; DO NOT EDIT.

package proto

import (
	"fmt"
	"strings"
)

const _IntervalScaleName = "IntervalSecondIntervalMinuteIntervalHourIntervalDayIntervalWeekIntervalMonthIntervalQuarterIntervalYear"

var _IntervalScaleIndex = [...]uint8{0, 14, 28, 40, 51, 63, 76, 91, 103}

const _IntervalScaleLowerName = "intervalsecondintervalminuteintervalhourintervaldayintervalweekintervalmonthintervalquarterintervalyear"

func (i IntervalScale) String() string {
	if i >= IntervalScale(len(_IntervalScaleIndex)-1) {
		return fmt.Sprintf("IntervalScale(%d)", i)
	}
	return _IntervalScaleName[_IntervalScaleIndex[i]:_IntervalScaleIndex[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 _IntervalScaleNoOp() {
	var x [1]struct{}
	_ = x[IntervalSecond-(0)]
	_ = x[IntervalMinute-(1)]
	_ = x[IntervalHour-(2)]
	_ = x[IntervalDay-(3)]
	_ = x[IntervalWeek-(4)]
	_ = x[IntervalMonth-(5)]
	_ = x[IntervalQuarter-(6)]
	_ = x[IntervalYear-(7)]
}

var _IntervalScaleValues = []IntervalScale{IntervalSecond, IntervalMinute, IntervalHour, IntervalDay, IntervalWeek, IntervalMonth, IntervalQuarter, IntervalYear}

var _IntervalScaleNameToValueMap = map[string]IntervalScale{
	_IntervalScaleName[0:14]:        IntervalSecond,
	_IntervalScaleLowerName[0:14]:   IntervalSecond,
	_IntervalScaleName[14:28]:       IntervalMinute,
	_IntervalScaleLowerName[14:28]:  IntervalMinute,
	_IntervalScaleName[28:40]:       IntervalHour,
	_IntervalScaleLowerName[28:40]:  IntervalHour,
	_IntervalScaleName[40:51]:       IntervalDay,
	_IntervalScaleLowerName[40:51]:  IntervalDay,
	_IntervalScaleName[51:63]:       IntervalWeek,
	_IntervalScaleLowerName[51:63]:  IntervalWeek,
	_IntervalScaleName[63:76]:       IntervalMonth,
	_IntervalScaleLowerName[63:76]:  IntervalMonth,
	_IntervalScaleName[76:91]:       IntervalQuarter,
	_IntervalScaleLowerName[76:91]:  IntervalQuarter,
	_IntervalScaleName[91:103]:      IntervalYear,
	_IntervalScaleLowerName[91:103]: IntervalYear,
}

var _IntervalScaleNames = []string{
	_IntervalScaleName[0:14],
	_IntervalScaleName[14:28],
	_IntervalScaleName[28:40],
	_IntervalScaleName[40:51],
	_IntervalScaleName[51:63],
	_IntervalScaleName[63:76],
	_IntervalScaleName[76:91],
	_IntervalScaleName[91:103],
}

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

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

// IntervalScaleValues returns all values of the enum
func IntervalScaleValues() []IntervalScale {
	return _IntervalScaleValues
}

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

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