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

package cri

import (
	"fmt"
	"strings"
)

const _ImageCacheStatusName = "unknowndisabledpreparingready"

var _ImageCacheStatusIndex = [...]uint8{0, 7, 15, 24, 29}

const _ImageCacheStatusLowerName = "unknowndisabledpreparingready"

func (i ImageCacheStatus) String() string {
	if i < 0 || i >= ImageCacheStatus(len(_ImageCacheStatusIndex)-1) {
		return fmt.Sprintf("ImageCacheStatus(%d)", i)
	}
	return _ImageCacheStatusName[_ImageCacheStatusIndex[i]:_ImageCacheStatusIndex[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 _ImageCacheStatusNoOp() {
	var x [1]struct{}
	_ = x[ImageCacheStatusUnknown-(0)]
	_ = x[ImageCacheStatusDisabled-(1)]
	_ = x[ImageCacheStatusPreparing-(2)]
	_ = x[ImageCacheStatusReady-(3)]
}

var _ImageCacheStatusValues = []ImageCacheStatus{ImageCacheStatusUnknown, ImageCacheStatusDisabled, ImageCacheStatusPreparing, ImageCacheStatusReady}

var _ImageCacheStatusNameToValueMap = map[string]ImageCacheStatus{
	_ImageCacheStatusName[0:7]:        ImageCacheStatusUnknown,
	_ImageCacheStatusLowerName[0:7]:   ImageCacheStatusUnknown,
	_ImageCacheStatusName[7:15]:       ImageCacheStatusDisabled,
	_ImageCacheStatusLowerName[7:15]:  ImageCacheStatusDisabled,
	_ImageCacheStatusName[15:24]:      ImageCacheStatusPreparing,
	_ImageCacheStatusLowerName[15:24]: ImageCacheStatusPreparing,
	_ImageCacheStatusName[24:29]:      ImageCacheStatusReady,
	_ImageCacheStatusLowerName[24:29]: ImageCacheStatusReady,
}

var _ImageCacheStatusNames = []string{
	_ImageCacheStatusName[0:7],
	_ImageCacheStatusName[7:15],
	_ImageCacheStatusName[15:24],
	_ImageCacheStatusName[24:29],
}

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

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

// ImageCacheStatusValues returns all values of the enum
func ImageCacheStatusValues() []ImageCacheStatus {
	return _ImageCacheStatusValues
}

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

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

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

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