package com.ningdatech.carapi.safe.constant;

import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @return
 * @author CMM
 * @since 2022/12/27 10:29
 */
@Getter
@AllArgsConstructor
public enum VehicleAccidentReportStatusEnum {
    UNDER_REPORT(0,"未上报"),

    REPORTED(1,"已上报");

    private  Integer code;
    private  String desc;

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

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

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