package com.ningdatech.carapi.driver.constant;

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

@Getter
@AllArgsConstructor
public enum DriverAbnormalBehaviorAppendixTypeEnum {
    PICTURE(0,"图片"),

    VIDEO(1,"视频"),

    OTHER(2,"其他");

    private Integer code;
    private String desc;

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

    public static String getDescByCode(String code) {
        if(StringUtils.isBlank(code)){
            return StringUtils.EMPTY;
        }
        for (DriverAbnormalBehaviorAppendixTypeEnum t : DriverAbnormalBehaviorAppendixTypeEnum.values()) {
            if (code.equals(t.getCode())) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

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