package com.lantone.security.enums;

import com.lantone.common.constant.KeyedNamed;
import lombok.Setter;

/**
 * @ClassName: SoftwareEnum
 * @Description: 服务注解
 * @Author songxl
 * @Date 2021/7/21
 * @Version 1.0
 */
public enum SoftwareEnum implements KeyedNamed {
    AI_END_SERVICE(1, "AI终末质控系统"),
    AI_RUN_SERVICE(2, "AI运行质控系统");

    @Setter
    private int key;

    @Setter
    private String name;

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

    public static SoftwareEnum getEnum(int key) {
        for (SoftwareEnum item : SoftwareEnum.values()) {
            if (item.key == key) {
                return item;
            }
        }
        return null;
    }

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

    @Override
    public int getKey() {
        return key;
    }

    @Override
    public String getName() {
        return name;
    }
}
