package com.ningdatech.carapi.driver.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author CMM
 * @description
 * @since 2022/12/05 15:31
 */
@AllArgsConstructor
@Getter
public enum  DriverAbnormalBehaviorProcessingEnum {

    UN_DEAL(0,"待处理"),
    DEAL(1,"已处理");

    private  Integer code;
    private  String desc;

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescByCode(Integer code) {
        if(Objects.nonNull(code)){
            return StringUtils.EMPTY;
        }
        for (DriverAbnormalBehaviorProcessingEnum t : DriverAbnormalBehaviorProcessingEnum.values()) {
            if (code.equals(t.getCode())) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

    public boolean eq(String val) {
        return this.name().equals(val);
    }

}
