2025-01-17 10:34:44 +01:00
|
|
|
|
package enum
|
|
|
|
|
|
|
|
|
|
|
|
type CompletionStatus int
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
DRAFTED CompletionStatus = iota
|
|
|
|
|
|
PENDING
|
|
|
|
|
|
CANCEL
|
|
|
|
|
|
PARTIAL
|
|
|
|
|
|
PAID
|
|
|
|
|
|
DISPUTED
|
|
|
|
|
|
OVERDUE
|
|
|
|
|
|
REFUND
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func (d CompletionStatus) String() string {
|
|
|
|
|
|
return [...]string{"drafted", "pending", "cancel", "partial", "paid", "disputed", "overdue", "refund"}[d]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func CompletionStatusList() []CompletionStatus {
|
|
|
|
|
|
return []CompletionStatus{DRAFTED, PENDING, CANCEL, PARTIAL, PAID, DISPUTED, OVERDUE, REFUND}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type BookingStatus int
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
DRAFT BookingStatus = iota
|
|
|
|
|
|
SCHEDULED
|
|
|
|
|
|
STARTED
|
|
|
|
|
|
FAILURE
|
|
|
|
|
|
SUCCESS
|
|
|
|
|
|
FORGOTTEN
|
|
|
|
|
|
DELAYED
|
|
|
|
|
|
CANCELLED
|
2026-04-10 09:57:51 +02:00
|
|
|
|
IN_PREPARATION
|
2025-01-17 10:34:44 +01:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var str = [...]string{
|
|
|
|
|
|
"draft",
|
|
|
|
|
|
"scheduled",
|
|
|
|
|
|
"started",
|
|
|
|
|
|
"failure",
|
|
|
|
|
|
"success",
|
|
|
|
|
|
"forgotten",
|
|
|
|
|
|
"delayed",
|
|
|
|
|
|
"cancelled",
|
2026-04-10 09:57:51 +02:00
|
|
|
|
"in_preparation",
|
2025-01-17 10:34:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func FromInt(i int) string {
|
|
|
|
|
|
return str[i]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (d BookingStatus) String() string {
|
|
|
|
|
|
return str[d]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// EnumIndex - Creating common behavior - give the type a EnumIndex functio
|
|
|
|
|
|
func (d BookingStatus) EnumIndex() int {
|
|
|
|
|
|
return int(d)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// List
|
|
|
|
|
|
func StatusList() []BookingStatus {
|
2026-04-10 09:57:51 +02:00
|
|
|
|
return []BookingStatus{DRAFT, SCHEDULED, STARTED, FAILURE, SUCCESS, FORGOTTEN, DELAYED, CANCELLED, IN_PREPARATION}
|
2025-01-17 10:34:44 +01:00
|
|
|
|
}
|