package com.ningdatech.carapi.safe.constant;

import org.apache.commons.lang3.StringUtils;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author CMM
 * @since 2022/12/26 16:52
 */
@Getter
@AllArgsConstructor
public enum VehicleAccidentReportEnum {
    UN_AUDIT(0,"待审核"),

    AUDIT_APPROVED(1,"审核通过"),

    AUDIT_REJECTED(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 (VehicleAccidentReportEnum t : VehicleAccidentReportEnum.values()) {
            if (code.equals(t.getCode())) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

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