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

package imageropts

import (
	"fmt"
	"strings"
)

const _BootloaderKindName = "nonedual-bootsd-bootgrub"

var _BootloaderKindIndex = [...]uint8{0, 4, 13, 20, 24}

const _BootloaderKindLowerName = "nonedual-bootsd-bootgrub"

func (i BootloaderKind) String() string {
	if i < 0 || i >= BootloaderKind(len(_BootloaderKindIndex)-1) {
		return fmt.Sprintf("BootloaderKind(%d)", i)
	}
	return _BootloaderKindName[_BootloaderKindIndex[i]:_BootloaderKindIndex[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 _BootloaderKindNoOp() {
	var x [1]struct{}
	_ = x[BootLoaderKindNone-(0)]
	_ = x[BootLoaderKindDualBoot-(1)]
	_ = x[BootLoaderKindSDBoot-(2)]
	_ = x[BootLoaderKindGrub-(3)]
}

var _BootloaderKindValues = []BootloaderKind{BootLoaderKindNone, BootLoaderKindDualBoot, BootLoaderKindSDBoot, BootLoaderKindGrub}

var _BootloaderKindNameToValueMap = map[string]BootloaderKind{
	_BootloaderKindName[0:4]:        BootLoaderKindNone,
	_BootloaderKindLowerName[0:4]:   BootLoaderKindNone,
	_BootloaderKindName[4:13]:       BootLoaderKindDualBoot,
	_BootloaderKindLowerName[4:13]:  BootLoaderKindDualBoot,
	_BootloaderKindName[13:20]:      BootLoaderKindSDBoot,
	_BootloaderKindLowerName[13:20]: BootLoaderKindSDBoot,
	_BootloaderKindName[20:24]:      BootLoaderKindGrub,
	_BootloaderKindLowerName[20:24]: BootLoaderKindGrub,
}

var _BootloaderKindNames = []string{
	_BootloaderKindName[0:4],
	_BootloaderKindName[4:13],
	_BootloaderKindName[13:20],
	_BootloaderKindName[20:24],
}

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

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

// BootloaderKindValues returns all values of the enum
func BootloaderKindValues() []BootloaderKind {
	return _BootloaderKindValues
}

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

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

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

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