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

package nethelpers

import (
	"fmt"
)

const (
	_RouteFlagName_0 = "notify"
	_RouteFlagName_1 = "cloned"
	_RouteFlagName_2 = "equalize"
	_RouteFlagName_3 = "prefix"
	_RouteFlagName_4 = "lookup_table"
	_RouteFlagName_5 = "fib_match"
	_RouteFlagName_6 = "offload"
	_RouteFlagName_7 = "trap"
)

var (
	_RouteFlagIndex_0 = [...]uint8{0, 6}
	_RouteFlagIndex_1 = [...]uint8{0, 6}
	_RouteFlagIndex_2 = [...]uint8{0, 8}
	_RouteFlagIndex_3 = [...]uint8{0, 6}
	_RouteFlagIndex_4 = [...]uint8{0, 12}
	_RouteFlagIndex_5 = [...]uint8{0, 9}
	_RouteFlagIndex_6 = [...]uint8{0, 7}
	_RouteFlagIndex_7 = [...]uint8{0, 4}
)

func (i RouteFlag) String() string {
	switch {
	case i == 256:
		return _RouteFlagName_0
	case i == 512:
		return _RouteFlagName_1
	case i == 1024:
		return _RouteFlagName_2
	case i == 2048:
		return _RouteFlagName_3
	case i == 4096:
		return _RouteFlagName_4
	case i == 8192:
		return _RouteFlagName_5
	case i == 16384:
		return _RouteFlagName_6
	case i == 32768:
		return _RouteFlagName_7
	default:
		return fmt.Sprintf("RouteFlag(%d)", i)
	}
}

var _RouteFlagValues = []RouteFlag{256, 512, 1024, 2048, 4096, 8192, 16384, 32768}

var _RouteFlagNameToValueMap = map[string]RouteFlag{
	_RouteFlagName_0[0:6]:  256,
	_RouteFlagName_1[0:6]:  512,
	_RouteFlagName_2[0:8]:  1024,
	_RouteFlagName_3[0:6]:  2048,
	_RouteFlagName_4[0:12]: 4096,
	_RouteFlagName_5[0:9]:  8192,
	_RouteFlagName_6[0:7]:  16384,
	_RouteFlagName_7[0:4]:  32768,
}

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

// RouteFlagValues returns all values of the enum
func RouteFlagValues() []RouteFlag {
	return _RouteFlagValues
}

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

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

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