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
	IN_PREPARATION
)

var str = [...]string{
	"draft",
	"scheduled",
	"started",
	"failure",
	"success",
	"forgotten",
	"delayed",
	"cancelled",
	"in_preparation",
}

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 {
	return []BookingStatus{DRAFT, SCHEDULED, STARTED, FAILURE, SUCCESS, FORGOTTEN, DELAYED, CANCELLED, IN_PREPARATION}
}
