package com.yuchen.saas.device.api.enums.scene;

import org.apache.commons.lang3.StringUtils;

/**
 * 场景联动规则触发类型 字典
 */
public enum DeviceSceneLinkageRuleTriggerTypeEnum {

    TRIGGER_TYPE_PROPERTY("设备状态-属性","property"),
    TRIGGER_TYPE_EVENT("设备状态-事件","event"),
    TRIGGER_TYPE_DEVICESTATUSCHANGE("上下线触发","deviceStatusChange"),
    TRIGGER_TYPE_MANUAL("手动执行","manual"),
    TRIGGER_TYPE_CRON("定时执行","cron"),

    ;
    private String value;
    private String name;

    DeviceSceneLinkageRuleTriggerTypeEnum(String name, String value){
        this.value=value;
        this.name=name;
    }

    public static String getNameByValue(String value){
        if(StringUtils.isBlank(value)){
            return null;
        }
        for(DeviceSceneLinkageRuleTriggerTypeEnum deviceSceneLinkageRuleTriggerTypeEnum:DeviceSceneLinkageRuleTriggerTypeEnum.values()){
            if(value.equals(deviceSceneLinkageRuleTriggerTypeEnum.getValue())){
                return deviceSceneLinkageRuleTriggerTypeEnum.name;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
