// Code generated by "enumer -type=MachineStage -type=KernelModuleState -type=KernelModuleType -type FIPSState -type=SELinuxState -linecomment -text"; DO NOT EDIT.

package runtime

import (
	"fmt"
	"strings"
)

const _SELinuxStateName = "disabledenabled, permissiveenabled, enforcing"

var _SELinuxStateIndex = [...]uint8{0, 8, 27, 45}

const _SELinuxStateLowerName = "disabledenabled, permissiveenabled, enforcing"

func (i SELinuxState) String() string {
	if i < 0 || i >= SELinuxState(len(_SELinuxStateIndex)-1) {
		return fmt.Sprintf("SELinuxState(%d)", i)
	}
	return _SELinuxStateName[_SELinuxStateIndex[i]:_SELinuxStateIndex[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 _SELinuxStateNoOp() {
	var x [1]struct{}
	_ = x[SELinuxStateDisabled-(0)]
	_ = x[SELinuxStatePermissive-(1)]
	_ = x[SELinuxStateEnforcing-(2)]
}

var _SELinuxStateValues = []SELinuxState{SELinuxStateDisabled, SELinuxStatePermissive, SELinuxStateEnforcing}

var _SELinuxStateNameToValueMap = map[string]SELinuxState{
	_SELinuxStateName[0:8]:        SELinuxStateDisabled,
	_SELinuxStateLowerName[0:8]:   SELinuxStateDisabled,
	_SELinuxStateName[8:27]:       SELinuxStatePermissive,
	_SELinuxStateLowerName[8:27]:  SELinuxStatePermissive,
	_SELinuxStateName[27:45]:      SELinuxStateEnforcing,
	_SELinuxStateLowerName[27:45]: SELinuxStateEnforcing,
}

var _SELinuxStateNames = []string{
	_SELinuxStateName[0:8],
	_SELinuxStateName[8:27],
	_SELinuxStateName[27:45],
}

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

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

// SELinuxStateValues returns all values of the enum
func SELinuxStateValues() []SELinuxState {
	return _SELinuxStateValues
}

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

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

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

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