package com.ningdatech.pmapi.performance.enumration;

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

import java.util.Objects;

/**
 * <p>
 * PerformanceTemplateTypeEnum
 * </p>
 *
 * @author Poffy
 * @since 16:56 2023/6/27
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PerformanceTemplateTypeEnum {
    /**
     * 模板类型
     */
    FIRST_INDEX(1, "第一指标"),
    SECOND_INDEX(2, "第二指标"),
    THIRD_INDEX(3, "第三指标");

    private Integer code;
    private String desc;

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