package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 校验类型
 * @author： zhanghang
 * @time: 2022/3/4 16:03
 */
public enum ColumnVerifyTypeEnum {

    UNKNOWN_TYPE("0", "未知"),
    NONNULL_TYPE("1", "数据缺失"),
    STANDARD_TYPE("2", "标准值"),
    REGULAR_TYPE("3", "正则");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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