package entity

import "math/rand"

type KindBoxType string

const (
	KindBoxOnTable     = KindBoxType("on-table")
	KindBoxCylindrical = KindBoxType("cylindrical")
	KindBoxStandUp     = KindBoxType("stand-up")
)

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

func (s KindBoxType) IsValid() bool {
	_, ok := KindBoxTypeStrings[s]

	return ok
}

func (s KindBoxType) GetRandom() KindBoxType {
	var values []KindBoxType

	for _, v := range KindBoxTypeStrings {
		values = append(values, KindBoxType(v))
	}
	if len(values) > 0 {
		return values[rand.Intn(len(values))]
	}
	return KindBoxOnTable
}
