package com.usky.rule.enums;

import com.usky.rule.exception.BizException;
import java.util.Objects;

public enum ActionTypeEnum {
    ALARM_EVENT("alarmEvent"),
    WORK_ORDER("workOrder"),
    DEVICE_CONTROL("deviceControl");

    private final String type;

    private ActionTypeEnum(String type) {
        this.type = type;
    }

    public static ActionTypeEnum getTypeEnum(String type) {
        for(ActionTypeEnum typeEnum : values()) {
            if (Objects.equals(typeEnum.getType(), type)) {
                return typeEnum;
            }
        }

        throw new BizException("不支持该类型的执行动作");
    }

    public String getType() {
        return this.type;
    }
}
