package com.hz.pm.api.projectlib.model.enumeration;

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

/**
 * <p>
 * ProjectTypeNewEnum
 * </p>
 *
 * @author Poffy
 * @since 16:56 2023/2/11
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum ProjectTypeNewEnum {
    /**
     * 项目类型
     */
    FIRST_BUILD("01", "首次建设"),
    SJ_BUILD("02", "迭代升级"),
    SZ_BUILD("03", "结转建设"),
    NEW_OPERA("04", "新运维"),
    XU_OPERA("05", "续运维");

    private String code;
    private String desc;

    public static String getDesc(String code) {
        if (StringUtils.isBlank(code)) {
            return StringUtils.EMPTY;
        }
        for (ProjectTypeNewEnum t : ProjectTypeNewEnum.values()) {
            if (code.equals(t.getCode())) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

    public static ProjectTypeNewEnum match(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (ProjectTypeNewEnum t : ProjectTypeNewEnum.values()) {
            if (code.equals(t.getCode())) {
                return t;
            }
        }
        return null;
    }
}
