niki/entity/kind_box_status.go

45 lines
1.1 KiB
Go

package entity
type KindBoxStatus uint
const (
KindBoxDeliveredStatus KindBoxStatus = iota + 1
KindBoxReadyToReturnStatus
KindBoxAssignedReceiverAgentStatus
KindBoxReturnedStatus
KindBoxEnumeratedStatus
)
var kindBoxStatusStrings = map[KindBoxStatus]string{
KindBoxDeliveredStatus: "delivered",
KindBoxReadyToReturnStatus: "ready-to-return",
KindBoxAssignedReceiverAgentStatus: "assigned-receiver-agent",
KindBoxReturnedStatus: "returned",
KindBoxEnumeratedStatus: "enumerated",
}
func (s KindBoxStatus) String() string {
return kindBoxStatusStrings[s]
}
// AllKindBoxStatus returns a slice containing all string values of KindBoxStatus.
func AllKindBoxStatus() []string {
statusStrings := make([]string, len(kindBoxStatusStrings))
for status, str := range kindBoxStatusStrings {
statusStrings[int(status)-1] = str
}
return statusStrings
}
// MapToKindBoxStatus converts a string to the corresponding KindBoxStatus value.
func MapToKindBoxStatus(statusStr string) KindBoxStatus {
for status, str := range kindBoxStatusStrings {
if str == statusStr {
return status
}
}
return KindBoxStatus(0)
}