package entity

type ReferTimeStatus uint

const (
	ReferTimeActiveStatus ReferTimeStatus = iota + 1
	ReferTimeInactiveStatus
)

var ReferTimeStatusStrings = map[ReferTimeStatus]string{
	ReferTimeActiveStatus:   "active",
	ReferTimeInactiveStatus: "inactive",
}

func (s ReferTimeStatus) String() string {
	return ReferTimeStatusStrings[s]
}

func (s ReferTimeStatus) IsValid() bool {
	return s > 0 && int(s) <= len(ReferTimeStatusStrings)
}

// AllReferTimeStatus returns a slice containing all string values of ReferTimeStatus.
func AllReferTimeStatus() []string {
	statusStrings := make([]string, len(ReferTimeStatusStrings))
	for status, str := range ReferTimeStatusStrings {
		statusStrings[int(status)-1] = str
	}

	return statusStrings
}

// MapToReferTimeStatus converts a string to the corresponding ReferTimeStatus value.
func MapToReferTimeStatus(statusStr string) ReferTimeStatus {
	for status, str := range ReferTimeStatusStrings {
		if str == statusStr {
			return status
		}
	}

	return ReferTimeStatus(0)
}
