package com.hz.pm.api.gov.enumeration;

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

import java.util.Objects;

/**
 * GovProjectClassifiedEnum
 *
 * @return
 * @author ZPF
 * @since 2023/10/24 16:27
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum GovProjectClassifiedEnum {
    /**
     *  是否涉密
     */
    NOT_CLASSIFIED("01", "非涉密"),
    CLASSIFIED("02", "涉密"),;

    private String code;
    private String desc;

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

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