package com.ningdatech.pmapi.staging.enums;

import com.ningdatech.pmapi.projectlib.enumeration.StepStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 消息类型枚举
 * @author CMM
 * @since 2023/02/28 17:34
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum MsgTypeEnum {
    /**
     * 消息类型
     */
    AUDIT(1, "项目审核(待审核)"),
    PASS(2, "项目审核(通过)"),
    REJECTED(3,"项目审核(被驳回)"),
    BACKED(4,"项目审核(被退回)"),
    WARING(5,"预警提醒"),
    EXPORT_REVIEW(6,"专家评审"),
    REVIEW_MEETING(7,"评审会议");

    private Integer code;
    private String desc;

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

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


}
