package com.ningdatech.carapi.report.constant;

import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 直报系统数据审核状态
 * @return
 * @author CMM
 * @since 2023/02/07 13:55
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "DataUploadAuditStatusEnum", description = "直报系统数据审核状态-枚举")
public enum DataUploadAuditStatusEnum {

    /**
     * 审核中
     */
    UNDER_AUDIT(1,"审核中"),

    /**
     * 审核通过
     */
    AUDIT_PASS(2, "审核通过"),

    /**
     * 被退回
     */
    AUDIT_BACK(3,"被退回"),

    /**
     * 未上报
     */
    NOT_REPORT(4,"未上报");

    private Integer code;
    private String desc;


    public String getDesc() {
        return desc;
    }

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

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

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

}
