forked from ebhomengo/niki
54 lines
1.2 KiB
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)
|
||
|
}
|