package com.ningdatech.pmapi.projectlib.enumeration;

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

import java.util.Objects;

/**
 * <p>
 * ProjectTypeEnum
 * </p>
 *
 * @author Poffy
 * @since 16:56 2023/2/11
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ProjectTypeEnum {
    /**
     * 项目类型
     */
    BUILD(1, "建设"),
    DEV_OPS(2, "运维");

    private Integer code;
    private String desc;

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