package member

// AlarmType 警報類型
type AlarmType int32

func (a *AlarmType) CodeToString() string {
	result, ok := verifyAlarmMap[*a]
	if !ok {
		return ""
	}

	return result
}

var verifyAlarmMap = map[AlarmType]string{
	AlarmUninitialized: "uninitialized", // 初始狀態（異常）
	AlarmNoAlert:       "no_alert",      // 未告警
	AlarmSystem:        "system_alert",  // 系統告警中
}

const (
	AlarmUninitialized AlarmType = 0 // 初始狀態（異常）
	AlarmNoAlert       AlarmType = 1 // 未告警
	AlarmSystem        AlarmType = 2 // 系統告警中
)

// IsValid returns true if the alarm type is valid
func (a AlarmType) IsValid() bool {
	return a >= AlarmUninitialized && a <= AlarmSystem
}
