package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 字段问题类型
 * @author： zhanghang
 * @time: 2022/3/4 16:03
 */
public enum ColumnResultTypeEnum {

    NONNULL_TYPE("1", "数据缺失"),
    STANDARD_TYPE("2", "非标准值"),
    REGULAR_TYPE("3", "正则校验失败");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

    ColumnResultTypeEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static ColumnResultTypeEnum getEnum(String key) {
        for (ColumnResultTypeEnum item : ColumnResultTypeEnum.values()) {
            if (item.key.equals(key)) {
                return item;
            }
        }
        return null;
    }

    public static String getName(String key) {
        ColumnResultTypeEnum item = getEnum(key);
        return item != null ? item.name : null;
    }
}
