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

import com.yuchen.saas.device.api.enums.assets.ImmobilizationAssetsStateEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 规则执行状态 字典
 */
@Getter
@AllArgsConstructor
public enum DeviceSceneLinkageRuleLogStatusEnum {

    EXECUTED_SUCCESS(1,"执行成功"),
    EXECUTED_ING(0,"执行中"),
    EXECUTED_FAIL(-1,"执行失败"),
    ;
    private final Integer code;
    private final String desc;

    public static String getDescByCode(Integer code) {
        if (Objects.nonNull(code)) {
            for (DeviceSceneLinkageRuleLogStatusEnum e : DeviceSceneLinkageRuleLogStatusEnum.values()) {
                if (e.getCode().equals(code)) {
                    return e.getDesc();
                }
            }
        }
        return "";
    }


}
