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

54 lines
1.2 KiB
Go

package entity
type KindBoxStatus uint
const (
KindBoxPendingSendStatus KindBoxStatus = iota + 1
KindBoxSentStatus
KindBoxPendingReceivedStatus
KindBoxRecievedStatus
KindBoxEnumeratedStatus
)
const (
kindBoxPendingSendStatus = "pending-send"
kindBoxSentStatus = "sent"
kindBoxPendingReceivedStatus = "pending-received"
kindBoxRecievedStatus = "received"
kindBoxEnumeratedStatus = "enumerated"
)
func (s KindBoxStatus) String() string {
switch s {
case KindBoxPendingSendStatus:
return kindBoxPendingSendStatus
case KindBoxSentStatus:
return kindBoxSentStatus
case KindBoxPendingReceivedStatus:
return kindBoxPendingReceivedStatus
case KindBoxRecievedStatus:
return kindBoxRecievedStatus
case KindBoxEnumeratedStatus:
return kindBoxEnumeratedStatus
}
return ""
}
func MapToKindBoxStatus(statusStr string) KindBoxStatus {
switch statusStr {
case kindBoxPendingSendStatus:
return KindBoxPendingSendStatus
case kindBoxSentStatus:
return KindBoxSentStatus
case kindBoxPendingReceivedStatus:
return KindBoxPendingReceivedStatus
case kindBoxRecievedStatus:
return KindBoxRecievedStatus
case kindBoxEnumeratedStatus:
return KindBoxEnumeratedStatus
}
return KindBoxStatus(0)
}