package com.lantone.daqe.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @Description: 是否必填注解
 * @author: zhanghang
 * @time: 2022/3/11 16:03
 */
public enum SolvedStatusEnum {
    NOT_SOLVED("0", "未解决"),
    IS_SOLVED("1", "已解决");

    @Getter
    @Setter
    private String key;

    @Getter
    @Setter
    private String name;

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

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

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