// Code generated by "enumer -type=RouteType -linecomment -text"; DO NOT EDIT.

package nethelpers

import (
	"fmt"
)

const _RouteTypeName = "unspecunicastlocalbroadcastanycastmulticastblackholeunreachableprohibitthrownatxresolve"

var _RouteTypeIndex = [...]uint8{0, 6, 13, 18, 27, 34, 43, 52, 63, 71, 76, 79, 87}

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

var _RouteTypeValues = []RouteType{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}

var _RouteTypeNameToValueMap = map[string]RouteType{
	_RouteTypeName[0:6]:   0,
	_RouteTypeName[6:13]:  1,
	_RouteTypeName[13:18]: 2,
	_RouteTypeName[18:27]: 3,
	_RouteTypeName[27:34]: 4,
	_RouteTypeName[34:43]: 5,
	_RouteTypeName[43:52]: 6,
	_RouteTypeName[52:63]: 7,
	_RouteTypeName[63:71]: 8,
	_RouteTypeName[71:76]: 9,
	_RouteTypeName[76:79]: 10,
	_RouteTypeName[79:87]: 11,
}

// RouteTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func RouteTypeString(s string) (RouteType, error) {
	if val, ok := _RouteTypeNameToValueMap[s]; ok {
		return val, nil
	}
	return 0, fmt.Errorf("%s does not belong to RouteType values", s)
}

// RouteTypeValues returns all values of the enum
func RouteTypeValues() []RouteType {
	return _RouteTypeValues
}

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

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

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