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

package nethelpers

import (
	"fmt"
)

const (
	_ScopeName_0 = "global"
	_ScopeName_1 = "site"
	_ScopeName_2 = "linkhostnowhere"
)

var (
	_ScopeIndex_0 = [...]uint8{0, 6}
	_ScopeIndex_1 = [...]uint8{0, 4}
	_ScopeIndex_2 = [...]uint8{0, 4, 8, 15}
)

func (i Scope) String() string {
	switch {
	case i == 0:
		return _ScopeName_0
	case i == 200:
		return _ScopeName_1
	case 253 <= i && i <= 255:
		i -= 253
		return _ScopeName_2[_ScopeIndex_2[i]:_ScopeIndex_2[i+1]]
	default:
		return fmt.Sprintf("Scope(%d)", i)
	}
}

var _ScopeValues = []Scope{0, 200, 253, 254, 255}

var _ScopeNameToValueMap = map[string]Scope{
	_ScopeName_0[0:6]:  0,
	_ScopeName_1[0:4]:  200,
	_ScopeName_2[0:4]:  253,
	_ScopeName_2[4:8]:  254,
	_ScopeName_2[8:15]: 255,
}

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

// ScopeValues returns all values of the enum
func ScopeValues() []Scope {
	return _ScopeValues
}

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

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

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