package entity

type KindBoxType uint

const (
	KindBoxOnTable KindBoxType = iota + 1
	KindBoxCylindrical
	KindBoxStandUp
)

var KindBoxTypeStrings = map[KindBoxType]string{
	KindBoxOnTable:     "on-table",
	KindBoxCylindrical: "cylindrical",
	KindBoxStandUp:     "stand-up",
}

func (s KindBoxType) String() string {
	return KindBoxTypeStrings[s]
}

func (s KindBoxType) IsValid() bool {
	return s > 0 && int(s) <= len(KindBoxTypeStrings)
}

// AllKindBoxType returns a slice containing all string values of KindBoxType.
func AllKindBoxType() []string {
	statusStrings := make([]string, len(KindBoxTypeStrings))
	for status, str := range KindBoxTypeStrings {
		statusStrings[int(status)-1] = str
	}

	return statusStrings
}

// MapToKindBoxType converts a string to the corresponding KindBoxType value.
func MapToKindBoxType(statusStr string) KindBoxType {
	for status, str := range KindBoxTypeStrings {
		if str == statusStr {
			return status
		}
	}

	return KindBoxType(0)
}
