forked from ebhomengo/niki
1
0
Fork 0
niki/entity/kind_box_req_status.go

45 lines
1.2 KiB
Go

package entity
type KindBoxReqStatus uint
const (
KindBoxReqPendingStatus KindBoxReqStatus = iota + 1
KindBoxReqAcceptedStatus
KindBoxReqAssignedSenderAgentStatus
KindBoxReqRejectedStatus
KindBoxReqDeliveredStatus
)
var kindBoxReqStatusStrings = map[KindBoxReqStatus]string{
KindBoxReqPendingStatus: "pending",
KindBoxReqAcceptedStatus: "accepted",
KindBoxReqAssignedSenderAgentStatus: "assigned-sender-agent",
KindBoxReqRejectedStatus: "rejected",
KindBoxReqDeliveredStatus: "delivered",
}
func (s KindBoxReqStatus) String() string {
return kindBoxReqStatusStrings[s]
}
// AllKindBoxReqStatus returns a slice containing all string values of KindBoxReqStatus.
func AllKindBoxReqStatus() []string {
statusStrings := make([]string, len(kindBoxStatusStrings))
for status, str := range kindBoxReqStatusStrings {
statusStrings[int(status)-1] = str
}
return statusStrings
}
// MapToKindBoxReqStatus converts a string to the corresponding KindBoxReqStatus value.
func MapToKindBoxReqStatus(statusStr string) KindBoxReqStatus {
for status, str := range kindBoxReqStatusStrings {
if str == statusStr {
return status
}
}
return KindBoxReqStatus(0)
}